DIP33: A standard exception hierarchy
Steven Schveighoffer
schveiguy at yahoo.com
Tue Apr 2 20:14:27 PDT 2013
On Tue, 02 Apr 2013 14:54:06 -0400, Jacob Carlborg <doob at me.com> wrote:
> On 2013-04-02 19:02, Steven Schveighoffer wrote:
>
>> Right, but what I see here is that the language uses one set of criteria
>> to determine whether it should catch, but it's difficult to use that
>> same criteria in order to process the exception. It's not easy to
>> switch on a class type, in fact it's downright ugly (maybe we need to
>> come up with a way to do that in normal code too).
>
> That's kind of breaking the whole point of OO and virtual functions, you
> should not need to know the exact type.
The example dictates we determine why the exception is thrown, yet that we
can't catch the exact type, because we would have to duplicate the code
block.
So we somehow have to catch the base type and then manually verify it's
one of the types we want, and rethrow otherwise. If there is a better
idea, I'd love to hear it.
-Steve
More information about the Digitalmars-d
mailing list