Thread overview
new operator chaining (D vs Java)
Aug 20, 2013
Luís Marques
Aug 20, 2013
Andrej Mitrovic
Aug 20, 2013
Luís Marques
Aug 20, 2013
deadalnix
Aug 20, 2013
Jacob Carlborg
August 20, 2013
I've used D to some extent since around 2004, but I don't recall noticing this before (although I wouldn't trust 9 year old memories!):

    D: (new Class()).foo();

    Java: new Class().foo();

Is there any particular (purposeful) reason why D cannot directly chain calls after new? (a quick Google search did not help).
August 20, 2013
On Tuesday, 20 August 2013 at 02:11:41 UTC, Luís Marques wrote:
> Is there any particular (purposeful) reason why D cannot directly chain calls after new? (a quick Google search did not help).

This syntax will work in the next release (2.064).
August 20, 2013
On Tuesday, 20 August 2013 at 02:20:27 UTC, Andrej Mitrovic wrote:
> This syntax will work in the next release (2.064).

Wow, now that is a coincidence! :-) (how it took me so long to notice it, just before it was going to be added to the language)
August 20, 2013
On Tuesday, 20 August 2013 at 02:25:35 UTC, Luís Marques wrote:
> On Tuesday, 20 August 2013 at 02:20:27 UTC, Andrej Mitrovic wrote:
>> This syntax will work in the next release (2.064).
>
> Wow, now that is a coincidence! :-) (how it took me so long to notice it, just before it was going to be added to the language)

That isn't coincidence ;) BTW, it is supposed to work by spec for ages.
August 20, 2013
On 2013-08-20 11:02, deadalnix wrote:
> On Tuesday, 20 August 2013 at 02:25:35 UTC, Luís Marques wrote:
>> On Tuesday, 20 August 2013 at 02:20:27 UTC, Andrej Mitrovic wrote:
>>> This syntax will work in the next release (2.064).
>>
>> Wow, now that is a coincidence! :-) (how it took me so long to notice
>> it, just before it was going to be added to the language)
>
> That isn't coincidence ;) BTW, it is supposed to work by spec for ages.

I have been adding parentheses in DWT for ages :(. At least it's good that it's finally changed.

-- 
/Jacob Carlborg