On Wednesday, 28 February 2018 at 13:43:37 UTC, SimonN wrote:
Hi,
Andrei said in 2014 that not-null-references should be the
priority of 2014's language design, with consideration to make
not-null the default. In case the code breakage is too high,
this can be an opt-in compiler flag.
[...]
I've slowly come around to supporting this idea. I'd rather avoid
segfaults in the first place and avoid extra effort checking for
null if possible.
It also sets clearer expectations for a user. For example, D now:
Class func(T param); // user always needs to worry about if the
return value is null or not, there may be that edge case where it
is null
D with non-nullable references:
Class func(T param); // user knows that the return value will not
be null, no need to check
Nullable!Class func(T param); // user knows they need to check
for null and handle it.
That's my two cents anyways