Checking function parameters in Phobos

Jonathan M Davis jmdavisProg at gmx.com
Wed Nov 20 12:13:05 PST 2013


On Wednesday, November 20, 2013 20:40:40 Meta wrote:
> On Wednesday, 20 November 2013 at 19:23:32 UTC, Jonathan M Davis
> 
> wrote:
> > On Wednesday, November 20, 2013 19:53:43 Meta wrote:
> >> Yes. It is very important not to allow direct access to the
> >> underlying value. This is important for ensuring that it is not
> >> put in an invalid state. This is a mistake that was made with
> >> std.typecons.Nullable, making it useless for anything other
> >> than
> >> giving a non-nullable type a null state (which, in fairness, is
> >> probably all that it was originally intended for).
> > 
> > It's arguably pretty pointless to put a nullable type in
> > std.typecons.Nullable. If you want a nullable type to be null,
> > just set it to
> > null.
> > 
> > - Jonathan M Davis
> 
> See the discussion from the other thread for why it can be useful
> to wrap a nullable reference in a option type (nullable is a
> pseudo-option type).

I know. And I still think that it's pointless - and it incurs extra overhead 
to boot, making it _worse_ than pointless. But clearly there's disagreement on 
the matter.

- Jonathan M Davis


More information about the Digitalmars-d mailing list