On 12/10/10 10:41 AM, Bruno Medeiros wrote:
On 30/11/2010 20:47, Andrei Alexandrescu wrote:
Same discussion goes about non-nullable. We don't need the compiler to
understand non-nullable types, we need to imbue the compiler with the
ability to enforce arbitrary user-defined state invariants, non-null
being one of them.
That would be great. That would be *really* great. There are lots of
useful invariants one might want to express. (something like Java's
wildcards for containers, or numeric ranges, maybe ownership
relationships, etc.)
However, just as it would be very useful, wouldn't it be an incredibly
compex feature set to implement, at least in a sufficiently generic and
useful way? Complex enough for it to be something that could not be
worked in anytime soon?
It's not complex, and the technology is understood. There is only a need
to handle flow inside constructors carefully.
Because the impression I get from Steven and others, is that this issue
is quite critical, and makes writing D code unpleasant in many
situations (I myself can't agree or disagree, haven't used D2 enough in
pratice, but their arguments and experience seem convincing)
Most languages do fine without non-nullable types, so I don't see the
urgency.
Andrei