DMD 0.148 - scope guard

Chris Miller chris at dprogramming.com
Mon Feb 27 09:40:56 PST 2006


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.



More information about the Digitalmars-d mailing list