scope(failure): get exception

Jacob Carlborg doob at me.com
Mon Oct 29 05:05:23 PDT 2012


On 2012-10-29 11:58, Jonathan M Davis wrote:

> Except that the place that scope statements go in the code is completely
> different from where catch statements go. catch statements go at the end
> whereas scope statements go in the middle or even the beginning so that what
> you're doing in there can be close to code that corresponds to it (e.g. you
> can have the code for releasing a resource right after the code for aquiring
> it rather than having it in a complete separate part of the code. What you
> typically do with scope  statements and try-catch statements is often
> fundamentally different.
>
> I can understand wanting to be able to have access to the exception that's
> flying by in a scope statement, but I really don't see how saving a try and
> couple of braces adds much. Certainly, the two are completely different in
> terms of what they buy you.

I've used it a couple of times in Ruby, only in very small methods. It's 
not a deal breaker, it's a "nice to have" feature.

-- 
/Jacob Carlborg


More information about the Digitalmars-d-learn mailing list