References in D

Henning Pohl henning at
Wed Oct 3 10:15:50 PDT 2012

On Wednesday, 3 October 2012 at 16:58:52 UTC, Maxim Fomin wrote:
> How much code would be broken by moving nullable references 
> from current state to "question mark notation"?
That's another question :]

> I expect that non-nullable class objects (called references 
> here) addition (if there is no objections to idea in general) 
> would not break much code and would not request vast syntax 
> changes. And it likely can be done by still defaulting to 
> nullable references. For example, it can be done with the help 
> of @nonnullable (like immutable) type qualifier and semantic 
> check of operations involving references with such qualifier.
Sounds like a deal for now, but @nonnullable will only work with 
class references and anything else will be an error. So directly 
attaching it to the type (like the questionmark) makes more sense.

> Anyway, my estimation of probability of accepting constructions 
> like "type&", "type*?", etc and defaulting to non-null 
> references is very low, at least for D2.
That's right, but let's use the youth of the language to change 
this. I guess many will hate me if we do so.

More information about the Digitalmars-d mailing list