Nullable or Optional? Or something else?

Danny Wilson bluezenix at gmail.com
Wed Sep 2 13:09:09 PDT 2009


Op Wed, 02 Sep 2009 21:39:28 +0200 schreef Andrei Alexandrescu  
<SeeWebsiteForEmail at erdani.org>:

> I plan to add a Nullable struct to Phobos (akin to C#'s Nullable,  
> Boost's Optional).
>
> Apparently a good design is to define Optional!T with a minimum of  
> member functions (ideally none) and have it use the "alias this" feature  
> to masquerade as a T. That way Optional!T looks and feels much like a T,  
> except that it supports a function
>
> bool isNull(T)(Optional!T value);
>
> Am I on the right track? If so, what is the name you'd prefer for this  
> artifact?
>
>
> Andrei


How about:  Maybe!T


Got that from Haskell :-)



More information about the Digitalmars-d mailing list