Suggestion: Change precedence of 'new'

Robert Fraser fraserofthenight at gmail.com
Wed Apr 9 21:31:57 PDT 2008


Unknown W. Brackets wrote:
> I think the problem is in supporting this syntax:
> 
> auto x = new package.module.Class;

The argument (as far as I can tell) is that it would be supported only 
if trailing parentheses were supplied, so that expression would have to 
be written as "new package.module.Class().propertyMethod;".

> In which case, differing it from this is difficult:
> 
> auto y = new package.module.Class.propertyMethod;
> 
> Anyway, I believe the docs say that it is always an error to rely on 
> order of operations... perhaps I'm wrong.

Not if the order is well defined, just when two operators have the same 
precedence. 2 + 5 * 3 should always evaluate to 17, never to 21.

> -[Unknown]



More information about the Digitalmars-d mailing list