blocks with attributes vs inlined lambda

monarch_dodra monarchdodra at gmail.com
Sat Jun 8 09:13:27 PDT 2013


On Saturday, 8 June 2013 at 15:56:47 UTC, deadalnix wrote:
>
> Sound like a nice idiom. Why is the first set of () needed ? 
> Can we change the grammar to remove them ?

It's because you are actually declaring a lambda that takes no 
arguments, and has no name, and contains a body. BTW, you quoted 
my incomplete code, the correct code I wanted to post was:

() nothrow {//anonymous lambade declaration
     //Body of the lambde
}() //actual call to lambda

I'd want to be able to do this, without either the first or last 
set of (). The required change of grammar would mean there'd be 
no lambda at all afterwards.


More information about the Digitalmars-d mailing list