Nullable or Optional? Or something else?
Rainer Deyke
rainerd at eldwood.com
Wed Sep 2 18:59:07 PDT 2009
Andrei Alexandrescu wrote:
> 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?
You need some syntactic way to distinguish the contained value from the
container. Using "alias this" seems messy here. Optional!Optional!T is
both valid and likely to occur.
--
Rainer Deyke - rainerd at eldwood.com
More information about the Digitalmars-d
mailing list