Andrei Alexandrescu wrote:
Walter Bright wrote:
Justin Johansson wrote:
Walter, in the heat of this thread I hope you haven't missed the
correlation with discussion
on "Dispatching on a variant" and noting:
Thanks for pointing it out. The facilities in D enable one to
construct a non-nullable type, and they are appropriate for many designs.
No. There is no means to disable default construction.
I looked into this slightly. You'd have to do mark non-nullable fields
as requiring ctor initialization, prevent reallocating arrays of
non-nullables, and a few other things. At the time I wasn't considering
struct constructors; without them, you'd have to forbid structs that
contain non-nullable fields, but with them, it's okay.
I just don't see them as a replacement for *all* reference types.
Non-nullable references should be the default.
Andrei