dereferencing null
bearophile
bearophileHUGS at lycos.com
Mon Mar 5 16:48:35 PST 2012
Jason House:
> The opAssign kills all type safety. I think only NotNull!T should
> be accepted... So "foo = bar" won't compile if bar is nullable.
> To fix, "foo = NotNull(bar)",
I think NotNull also needs this, as a workaround to what I think is a DMD bug:
@disable enum init = 0;
It disallows code like:
auto f1 = NotNull!Foo.init;
And I think NotNull needs a guard, to refuse std.typecons.Nullable:
struct NotNull(T) if (!IsNullable!T) {...
Where the IsNullable template is similar to std.typecons.isTuple (I think std.typecons needs a isTemplateInstance(T,Template)).
Bye,
bearophile
More information about the Digitalmars-d
mailing list