On Monday, 5 August 2013 at 12:49:11 UTC, Michal Minich wrote:
On Monday, 5 August 2013 at 12:40:26 UTC, Bosak wrote:
In C# there is this using construct:

just declare variable as scope, and ti will be destructed as son as function exits.

void foo ()
{
   scope obj = new Object;
} // obj will be destructed here

you can also use it together with anonymous scope (same as c#)

more generally, there is a "scope" statement http://dlang.org/exception-safe.html that can be used where normally try/finally (without catch) would be used, to achieve cleaner code.

Oh yes, I completely forgot about scope.

Reply via email to