Blogpost about the T.init problem
Meta
jared771 at gmail.com
Wed Jul 11 20:10:17 UTC 2018
On Wednesday, 11 July 2018 at 07:35:24 UTC, FeepingCreature wrote:
> On Wednesday, 11 July 2018 at 07:30:59 UTC, FeepingCreature
> wrote:
>> Then just stick it in a Nullable. No explicit .init needed.
>
> To clarify this point some more, since on reflection it's
> ambiguous: you might well say that "well yeah, the default
> constructor returns an invalid value, no shit it breaks." The
> semantics of Nullable are weird here though - Nullable!S
> constructs an S while pretending to not contain an S. The
> deeper problem is that there is straight up *no way* to
> implement Nullable correctly in a way that lets it handle types
> with @disabled this();
I hate to say I told you so, but...
https://github.com/dlang/phobos/pull/5855#issuecomment-345783238
Just joking, of course =)
Nullable has needed to be completely overhauled for a long time
because it was only really designed with POD types in mind.
More information about the Digitalmars-d-announce
mailing list