Similar to Type Declaration Characters such as $ (String), % (Integer), ! (Float), # (Double), & (LongInteger), which don't allow assignments of invalid, we could make the language null-safe by never allowing assignments of invalid unless the var name ends with ? by creating a runtime error.
Like in Swift, this value could be an associative array with two possible values in it, none or some, with the associated value. (Swift does that with an Enum). To assign an optional to a non-optional, an unwrapping function is needed which releases the some value or provides an alternative if none is encountered.
Similar to Type Declaration Characters such as
$
(String),%
(Integer),!
(Float),#
(Double),&
(LongInteger), which don't allow assignments ofinvalid
, we could make the language null-safe by never allowing assignments of invalid unless the var name ends with?
by creating a runtime error.Like in Swift, this value could be an associative array with two possible values in it,
none
orsome
, with the associated value. (Swift does that with anEnum
). To assign an optional to a non-optional, an unwrapping function is needed which releases thesome
value or provides an alternative ifnone
is encountered.