DMD 0.148 - scope guard

Lars Ivar Igesund larsivar at igesund.net
Mon Feb 27 10:29:49 PST 2006


Chris Miller wrote:

> On Sat, 25 Feb 2006 21:06:36 -0500, Walter Bright
> <newshound at digitalmars.com> wrote:
> 
>> Scope guards are a novel feature no other language has. They're based on
>> Andrei Alexandrescu's scope guard macros, which have led to considerable
>> interest in the idea. Check out the article
>> www.digitalmars.com/d/exception-safe.html
>>
> 
> This format looks good to me:
> 
> scope(exit)  foo();
> scope(success)  bar();
> scope(failure)  baz();
> 
> similar to extern(name), pragma(name), etc, requires one `scope` keyword,
> name in () doesn't need to be a keyword but is still treated special, and
> doesn't look bad.

Me votes for this too.



More information about the Digitalmars-d mailing list