Are Arrays first class?
- If the language has values, can an array be a value ?
- Can they be passed as parameters ?
- Can they be returned from functions ?
- Can you have an array of arrays ?
Are the dimensions part of the type?
Can you ...?
- Write polymorphic code ?
- Use an expression for the size ?
- Access the dimensions at run-time ?
Questions:
- Is an array of arrays the same as a multi-dimensional array ?
- Is there supporting syntax ?
- Can you access a slice of an array ?
(both rows and columns? portions of an array?)
Questions:
- Can we have different array types ?
- Is there subtyping between them ?
- Can we write polymorphic code ?
Decisions:
- length specified at creation;
- length stored in array;
- no multi-dim arrays;
- slices hard to implement.
Decisions:
- length part of type (optionally);
- polymorphic code over different lengths;
- multi-dim arrays;
- slices more possible.
Are records first class?
- If the language has values, can a record be a value ?
- Can they be passed as parameters ?
- Can they be returned from functions ?
- Can you have a record of records ?
What are the type rules?
- Does the type depend on the field names?
- Does the type depend on the order of field names?
- Is there width subtyping?
(can fields be omitted in a supertype?)
- Is there depth subtyping?
(can the subtype have a subtype for a field?)
Can records be mutable?
- Is a record ``really'' a pointer?
- Do we need to put references into the record?
- Can records get new fields? How?
How do we locate fields?
- Are fields aligned?
- If so, what about the ``empty'' space?
Does it get carried along? Does it affect
equality comparison?
- Are fields ordered differently from their lexical order?
- How do we distinguish the variants?
- Can a record change its variant?
- Can an object change its class?
John Tang Boyland
2004-11-10