aboutsummaryrefslogtreecommitdiff
path: root/notes/enum-indexed_arrays.txt
blob: 85534df030f70bd34cb7c832ad666f45adb52327 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28

Having arrays indexed by other things than just integers could be useful:

* Enum
* (Maybe) 1-byte characters / ASCII characters
    - Or perhaps allow integers to be subtyped into non-integer compatible
      types (but still "word-sized" and "ordinal").

Can lists and maps be unified?
------------------------------

A more extreme variant could be to have only different types of maps:

* Ordering:
    - by index
    - by insertion order
    - unordered
* Sparseness:
    - all indices are present
    - a 0-based range is present
    - an arbitrary range is present
    - sparse map with word-sized indices
    - sparse map with arbitrary-sized indices
* Deletion behavior
    - elements above are moved down
    - a hole is created

Ordering by index, 0-based range and move-down-on-delete is equivalent to a
list.