Default values vs nulls
Hontvári Attila
attila at hontvari.net
Thu Aug 6 09:04:32 UTC 2020
(resending, previous email had a confusing ending, ignore that)
The currently discussed solutions to the problem of uninitialized bucket
#3 values mostly seems like the following: the value set of the type is
extended with a special value that throws an exception if somebody
invokes a method on that, but instead of the name "null" it has a new
name and syntax: "V.default". But if we take for example a LocalDate, it
is a bit strange to say the fields with type LocalDate.val are
initialized to "LocalDate.default", because that type doesn't have an
acceptable default value: the variable just has no LocalDate value if
somebody haven't set one, and null means exactly that. This creates a
split between non-initialized reference types and inline types, which
might be unneecessary. It might be worth to investigate Option J, that
solves this by treating uninitialized default values as nulls, but
hasn't got as much attention as some other options.
More information about the valhalla-spec-comments
mailing list