15.10.2010 16:12, bearophile пишет:
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?

Aside from what was already mentioned about nested classes:
What if bar() is a static function of Foo? Current precedence allows the compiler to bug you if you write

new Foo.bar();

If precedence is modified in the way you propose, then you effectively get a call to static function through an instance (which in itself is valid operation), though that instance is immediately thrown away.

Reply via email to