<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On 4 August 2014 12:04, Mike Parker via Digitalmars-d <span dir="ltr"><<a href="mailto:digitalmars-d@puremagic.com" target="_blank">digitalmars-d@puremagic.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="">On 8/4/2014 12:28 AM, Manu via Digitalmars-d wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I'm trying to make better use of scope guards, but I find myself belting<br>
out try/catch statements almost everywhere.<br>
I'm rather disappointed, because scope guards are advertised to offer<br>
the promise of eliminating try/catch junk throughout your code, and I'm<br>
just not finding that to be the practical reality.<br>
<br>
I think the core of the problem is that scope(failure) is<br>
indiscriminate, but I want to filter it for particular exceptions. The<br>
other issue is that you still need a catch() if you don't actually want<br>
the program to terminate, which implies a try... :/<br>
</blockquote>
<br></div>
Scope guards are for when you don't need to handle exceptions. If you need the exceptions, use try...catch. I don't think it would be a good idea to have two different means of handling exceptions.<br></blockquote>
<div><br></div><div>Well, then they're not particularly useful in practise. I'm finding that I can rarely blanket an operation across all exceptions.</div><div>The nature of exceptions is that they are of a particular type, so why have no access to that concept when trying to respond to them...</div>
</div></div></div>