Keyword to avoid not null references

Namespace rswhite4 at googlemail.com
Sun Apr 22 03:58:09 PDT 2012


On Sunday, 22 April 2012 at 00:06:47 UTC, Adam D. Ruppe wrote:
> I just pushed an update to git with
> a few changes people have suggested.
>
> I removed one of the old opAssigns
> to keep a static type check.
>
> Added assumeNotNull and checkNotNull
> as entry points.

I didn't recognized this part until now.

The opAssign is still there and that's good.
If i got you right on git, you wouldn't allow something like this:
NotNull!(Foo) f = new Foo(); and instead you want that everybody 
writes
NotNull!(Foo) f = assumeNotNull(new Foo);
Is that correct?
If so, that would increase the annoying factor which is still 
there because of the explicit conversion constraint from Foo into 
NotNull!(Foo) which i described in my post above.


More information about the Digitalmars-d-learn mailing list