Operator precedence of "new"

Denis Koroskin 2korden at gmail.com
Fri Oct 15 05:17:07 PDT 2010


On Fri, 15 Oct 2010 16:12:24 +0400, bearophile <bearophileHUGS at lycos.com>  
wrote:

> Currently to call a method to a newly build object/struct you need:
>
> (new Foo).bar();
>
> But isn't it better to change the D operator precedence rules a bit and  
> allow new to bind more closely than the method call, to allow a syntax  
> like:
>
> new Foo.bar();
>
> Do you see bad side effects in this D2 change?
>
> Bye and thank you,
> bearophile

Isn't this syntax used to instantiate inner class/struct, declared in Foo?
The two are so much different there is really little point of sharing  
syntax for it.


More information about the Digitalmars-d-learn mailing list