DIP33: A standard exception hierarchy

Dmitry Olshansky dmitry.olsh at gmail.com
Tue Apr 2 09:57:58 PDT 2013


02-Apr-2013 17:43, Andrei Alexandrescu пишет:
> On 4/2/13 7:59 AM, Dmitry Olshansky wrote:
>> 02-Apr-2013 15:35, Andrei Alexandrescu пишет:
>>> On 4/2/13 7:24 AM, Dmitry Olshansky wrote:
>>>> You might want to add Visitor pattern to Exceptions but it's darn messy
>>>> to deal with and is an overkill most of the time.
>>>
>>> Actually I think that's a good thing to do.
>>>
>>
>> Why would be that? It doesn't solve the key problem of "try clause plus
>> a ton of semi-identical catches" used just to perform a mapping of X
>> handlers to Y subsets of errors. Plus visitor does the same dispatch
>> that is already addressed by exception handlers (or partly so).
>
> Visitor allows centralized and flexible handling of exceptions.
>
>> If somebody comes up with a reasonable Visitor pattern for Exceptions
>> that is flexible and fast then sure let's see it. I just doubt it'll
>> help anything on its own in any case.
>
> Well I think exceptions + factory + visitor is quite the connection.

The only place where visitor would fit nicely that I can think of is 
walking an exception chain.

Other then this for the moment let me stick with
"talk is cheap, show me the code" position :)


-- 
Dmitry Olshansky


More information about the Digitalmars-d mailing list