Struct with default ctor (Was: [dmd-beta] dmd 2.064 beta take 2)

Jonathan M Davis jmdavisProg at gmx.com
Sat May 18 21:06:11 PDT 2013


On Sunday, May 19, 2013 05:54:46 deadalnix wrote:
> Actually most languages does the reverse. They have non nullable
> type, and provide Nullable/Option/Maybe/whatever to allow for
> nullable type. It allow to ensure that null don't pops up in
> unexpected places, and that null must be handled when it is an
> option.

Most languages? I'm not aware of even _one_ C-based language that doesn't have 
null as the default for pointer/references types. They may have non-nullable 
reference types in addition to the nullable ones (though that's still rare in 
my experience), but they were all added later. The closest that there is is 
C++'s references, which aren't rebindable and in many ways act more like 
aliases than pointers.

Functional languages do less with nullable, but given D's ancestory, it's not 
at all surprising that nullable is the default, and it would be very bizarre 
if it weren't.

- Jonathan M Davis


More information about the Digitalmars-d mailing list