Just stumbled over the following design:
class S {...}
class R {
:
Nullable!S s;
:
}
s was checked in code like
R r;
:
if (r.s is null)
throw new Exception ("some error message");
At runtime the following was caught:
fatal error: caught Throwable: Called `get' on null Nullable!S
Why can't this programming error be detected at compile time? Is
it possible
to "lower" the Nullable operations if T is a class type such that
there
is only one level of nullification?
BTW: https://dlang.org/library/std/typecons/nullable.html
contains duplicate sections:
Function nullable
Function nullable
Struct Nullable
Struct Nullable