Option!T

Shammah Chancellor via Digitalmars-d digitalmars-d at puremagic.com
Tue Jul 1 13:35:51 PDT 2014


On 2014-07-01 12:45:11 +0000, w0rp said:

> I'm also strongly in favour of Option/Maybe types in general, as a 
> replacement for null. null is one of my pet hates, and things are much 
> nicer when the lack of a value is represented in the type system. (T or 
> Option!T)

I would have disagreed with you in the past, but I just read some 
examples from Rust and other languages with strong type systems and I'm 
a convert.  I'd like to see a compiler flag to turn off null assignment 
to reference types to enforce Option/Nullable to be used.

I also liked garbage collected pointers being expressed by the type 
system.  Clarifies when libraries are expecting to take ownership of a 
pointer, etc.

-Shammah



More information about the Digitalmars-d mailing list