DMD 0.148 - scope guard

S. Chancellor dnewsgr at mephit.kicks-ass.org
Mon Feb 27 21:05:33 PST 2006


On 2006-02-25 18:06:36 -0800, "Walter Bright" <newshound at digitalmars.com> said:

> 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

The only thing I see that's amazingly useful about this is the 
on_scope_success.  Having a block of code that is only executed when an 
exception is NOT thrown would be nice.  However, the rest of this stuff 
seems like rocks under the water.  Your example of the new programmer 
coming in reads like this to me:  "The new programmer may not take the 
time to actually read the code he's modifying, so lets stick hidden 
stuff in there to take care of things he might have missed."  Which 
doesn't seem very logical to me, as it may be just as important to 
modify those on success/on failure blocks and miss them.

I'd say add another option to try..catch..finally paradigm.

-S.




More information about the Digitalmars-d mailing list