DMD 0.148 - scope guard

S. Chancellor dnewsgr at mephit.kicks-ass.org
Tue Feb 28 20:01:02 PST 2006


On 2006-02-28 00:08:01 -0800, "Andrew Fedoniouk" 
<news at terrainformatica.com> said:

> 
> "S. Chancellor" <dnewsgr at mephit.kicks-ass.org> wrote in message 
> news:du0lmk$dbg$1 at digitaldaemon.com...
>> 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.
>> 
> 
> try {
> 
>    something horrible here....
> 
>    //on_scope_success:
> 
>    ... and here is on success part
> 
> }
> 
> Why do you need separate 'passed' part?
> 
> Andrew.

You don't.  I wasn't thinking clearly.  I guess I was confused by the 
fact that there was an on_scope_success in this new addition.

-S.




More information about the Digitalmars-d mailing list