References in D

Jonathan M Davis jmdavisProg at gmx.com
Sat Sep 15 16:44:22 PDT 2012


On Saturday, September 15, 2012 22:12:57 Timon Gehr wrote:
> In a sane type system, optionality is a concept separate from a
> reference and it is much more general.

I'm not about to dispute that a better type system than we have could be 
devised, but what we have works well for the most part, and in every language 
that I've ever used that has anything like a pointer, pointers can be null. 
And D references are mostly treated like pointers, so it's not only perfectly 
natural for them to be nullable, it would be weird if they couldn't be.

Regardless, we have what we have, and it's not going to change for D2. A type 
system which separated out nullability like you suggest (or like Alex 
suggested with the additon of ? to the type) would be a huge departure from 
what we have.

- Jonathan M Davis


More information about the Digitalmars-d mailing list