Precedence of 'new' vs '.'

Derek Parnell derek at psych.ward
Tue May 5 17:49:39 PDT 2009


On Wed, 06 May 2009 00:39:12 +0200, Frank Benoit wrote:

> In Java one can write:
> 
> new MyClass().run();
> 
> in D this does not compile, parenthesis are needed.
> 
> (new MyClass()).run();
> 
> But why is the D language designed like that?

So presumably if it was changed to behave as Java, to get the current
functionality one would need to write ...

new (MyClass().run());

-- 
Derek Parnell
Melbourne, Australia
skype: derek.j.parnell



More information about the Digitalmars-d mailing list