<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Oct 6, 2014 at 7:50 AM, Andrei Alexandrescu 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"><span class="">On 10/6/14, 7:01 AM, H. S. Teoh via Digitalmars-d wrote:<br>
</span><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">
On Mon, Oct 06, 2014 at 06:46:31AM -0700, Andrei Alexandrescu via Digitalmars-d wrote:<br>
</span><div><div class="h5"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On 10/5/14, 11:39 PM, Dmitry Olshansky wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
It's obvious to me that one hierarchy is way to limiting for<br>
exceptions, simply because there could be many ways to categorize the<br>
same set of error conditions.<br>
</blockquote>
<br>
Well put. -- Andrei<br>
</blockquote>
<br></div></div><span class="">
What's the alternative, though? I can't think of any solution that<br>
(1) isn't far more complicated than the current state of things and<br>
(2) is easier to use.<br>
</span></blockquote>
<br>
I'm thinking a simple key-value store Variant[string] would accommodate any state needed for differentiating among exception kinds whenever that's necessary.<br>
<br></blockquote><div><br></div><div>And 'kinds' is a synonym for 'types' - You can have different kinds of problems, so you raise them with different kinds of exceptions.</div><div><br></div><div>s/kind/type/g and the question is: why not leverage the type system?</div><div><br></div><div>For a consumer-of-something-that-throws, having different types of exceptions for different things with different data makes sense.  You have to switch on something to determine what data you can get from the exception anyway.</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
It's commonly accepted that the usability scope of OOP has gotten significantly narrower since its heydays. However, surprisingly, the larger community hasn't gotten to the point to scrutinize object-oriented error handling, which as far as I can tell has never delivered.<br></blockquote><div><br></div><div>Maybe, but what fits better?  Errors/Exceptions have an inherent hierarchy, which maps well to a hierarchy of types.  When catching an Exception, you want to guarantee you only catch the kinds (types) of things you are looking for, and nothing else.</div><div><br></div><div> </div></div><br></div></div>