On Saturday, 8 June 2013 at 14:52:23 UTC, monarch_dodra wrote:
I remember think that being able to mark specific parts of code with certain attributes, inside a block, could be very useful.

for example:

--------
void foo()
{
   //Code

   /Critical section
   nothrow {
       //code here can't throw
   }

   //More code
}
--------

I have since learned that you can do this with lambda's instead, declaring and calling them in a single line:

--------
void foo()
{
   //Code

   /Critical section
   () nothrow
{
       //code here can't throw
   }

   //More code
}
--------

Sound like a nice idiom. Why is the first set of () needed ? Can we change the grammar to remove them ?

Reply via email to