D - Unsafe and doomed

Adam D. Ruppe destructionator at gmail.com
Sat Jan 4 06:46:26 PST 2014


On Saturday, 4 January 2014 at 12:37:34 UTC, ilya-stromberg wrote:
> Have you got any plans to impove this situation?

I wrote a NotNull struct for phobos that could catch that 
situation. I don't think it got pulled though.

http://arsdnet.net/dcode/notnull.d

With @disable is becomes reasonably possible to restrict built in 
types with wrapper structs. It isn't perfect but it isn't awful 
either.

The big thing people have asked for before is

Object foo;
if(auto obj = checkNull(foo)) {
    obj == NotNull!Object
} else {
   // foo is null
}

and i haven't figured that out yet...


More information about the Digitalmars-d mailing list