Comment #0 by default_357-line — 2020-11-24T09:28:19Z
Nullable.get default parameter should obviously be lazy. Every other default value in
the language is lazy. Unfortunately, Nullable's is not. This leads to unnecessary evaluations
of values that are never used.
Comment #1 by default_357-line — 2020-11-24T09:42:13Z
Oh, I see. It's an issue with lazy... I've tried to fix this, and it runs into the issue that lazy, being not templated, cannot transfer call site guarantees such as @safe and nothrow into the getter function, hence breaking get()'s annotations of nothrow and @safe in a way that makes it unusable in nothrow/@safe code.
And there is not even hope that DIP1033 fixes this, because the knowledge that the expression is @safe/nothrow cannot be transferred in through a function call - because the conversion to delegate happens *after* the template instantiation, and the delegate type is the first place that we could have @safe/nothrow knowledge.
Damn...
Comment #2 by robert.schadek — 2024-12-01T16:38:02Z