DMD 0.148 - scope guard

Yves Jacoby kloune at gmail.com
Mon Feb 27 23:43:05 PST 2006


On Mon, 27 Feb 2006 12:40:56 -0500, Chris Miller wrote:

I find this one better too.

> 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