why scope(success)?

Sean Kelly sean at f4.ca
Wed May 10 09:02:19 PDT 2006


Serg Kovrov wrote:
> 
> IMHO 'on scope exit' approach is not much different from 'one return at 
> end of function' with condition flag(s).

True.  But if the function is complex and has multiple return points, 
scope(success) is easier to maintain.

> And it is kind of obscure code for me - it can be anywhere in function, 
> maybe even may times, etc... It's hard to maintain (just like goto's), 
> and as so, it's no use for me at this point.

It's a matter of opinion, I suppose.  I find scope declarations more 
visible and more meaningful than the alternatives.  And I like that I 
can place them next to the declarations of data they're meant to affect, 
thus making the code more meaningful.


Sean



More information about the Digitalmars-d mailing list