Optional types ============== Optional types/variables could go at two locations: * At the type, such as: `?String name` * At the variable/field: `String name?` Note that the latter does not support optionals in generic parameters. The choice also affects changeability/mutability qualifiers. Syntax examples: # At type ?String name ?Writer! wr ?String last_url! ?List Int items # At variable String name? Writer! wr? String last_url!? List Int items? # or should `?` come before `!` String last_url?! Optional types in type-generic elements --------------------------------------- It would be tricky (but not impossible) to support optional types in type parameters of generic types. The problem is that the `None` value can appear both at the type parameter level (`T?`, where `T` is of an unknown type), and at the usage level `List ?String`. This could possibly be implemented by counting the "level" where the `None` value originates from. But is that possible to do with multiple levels of generics? Such as the following: StringMap List List String I think it should be possible. I don't think there could be more than a 2- level ambiguity, because each nesting level of the generic type has its own totally separate generic storage slot. So it should be sufficient to have 2 different `None` values: * `None` * `GenericNone` / `EmptySlot` / `BlankSlot` - This one could have be implemented separate value, in addition to the `NULL` value. Perhaps `1` (or all ones). This would also mean that the varstate tracking needs to be aware of 3 cases: EmptySlot, None, and value-present. Note that an EmptySlot means that the generic value does not exist at all, so it isn't None it not even valid (similar to an unassigned variable).