Checking function parameters in Phobos

Meta jared771 at gmail.com
Wed Nov 20 11:40:40 PST 2013


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).


More information about the Digitalmars-d mailing list