Pointers ======== Currently, SLUL has explicit pointers with the following properties: - not nullable (unless ?ref) - no access to the address (except dereferencing and comparing) - can merge into generic slots ("slot T") - can be compared. Limiting pointers ----------------- This could allow for optimizations AND possibly partially removing explicit pointers in types. - Disallow referencing a field inside a struct unless this is explicitly allowed? This will reduce aliasing. - Disallow referencing elementary types? (except for output parameters? and only to the stack?) - Disallow pointer comparison? (unless the type explicitly allows it?) There is a middle ground here: - Allow only the following to be referenced: 1. all "outer" types, i.e. that are not part of a struct. this includes both heap and stack allocations. 2. all named struct types. i.e. struct fields that are of a named struct type can still be referenced, despite not being an "outer" type. - Then, elementary types can only be referenced when allocated on the stack or when it constitutes a single heap allocation. Implicit pointers ----------------- Have different kinds of types? - "plain data" passed by reference if faster. no unique objects / no identity per object. no unique address. no comparison operation. - functions always passed by reference. no unique objects / no identity per object. no unique address. no comparison operation. - "identity data" always passed by reference. never de-duplicated. address can be compared to objects of the same type. - "system data" (e.g. streams, locks, etc) always passed by reference. never de-duplicated. address can be compared to objects of the same type. needs de-allocation. For "plain data" it could make sense to include them inline in a struct. Default-ref / Explicit copy --------------------------- Maybe it is better to explicitly specify when something is NOT a pointer (i.e. is copied)? The downside is that "arena" and "own" still need qualifiers. (Perhaps "arena" could be default in some contexts? e.g. local variables?) Current syntax, with ref: Point p = (1,2) arena Stream input = .from_string("abc") ref Matrix m = .[.[1,0,0], .[0,1,0], .[0,0,1]] Syntax with "inverted" syntax: value Point p = (1,2) arena Stream input = .from_string("abc") Matrix m = .[.[1,0,0], .[0,1,0], .[0,0,1]] Perhaps there should be a default for each type? Perhaps sigills (e.g. "@") should be used instead of the arena keyword?