Nullable with reference types
Meta via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Tue Jun 30 05:05:30 PDT 2015
On Tuesday, 30 June 2015 at 11:50:19 UTC, Marc Schütz wrote:
> On Tuesday, 30 June 2015 at 00:02:38 UTC, Meta wrote:
>> It's a design mistake in Nullable. I would suggest that either
>> never use Nullable with a type that already has a null value,
>> or use the "overload" of Nullable that takes a null value, and
>> set it to null. Example:
>>
>> Class Test {}
>> alias NullableTest = Nullable!(Test, null);
>
> Can we not specialize the other overload for references,
> pointers, and maybe slices?
Not now, as that would break code relying on this behaviour. I've
created a replacement for Nullable that does this, though, and it
works quite well.
More information about the Digitalmars-d-learn
mailing list