Ted
You wrote in message news:8tugk4$9lgo$
[hidden email]...
>
> I'm trying to build a framework for error handling, and in the literature
I
> come across references to both the Signal class and the Exception class.
> However, within Dolphin I can hardly find any references to the Signal
> class. It seems to me that the Signal class doesn't do much different from
> what is available in Exception as well. Therefore, why is it there and
when
> should it be used instead of Exception (or one of its subclasses)?
<Exception> is part of the ANSI standard exception handling framework in
Dolphin. It is a class-based mechanism in that new types of exceptions are
(naturally) created by deriving new classes of exception. Class-based
exception handling is natural in a class-based language, and allows one to
add behaviour to one's exceptions.
<Signal> is an instance-based exception class (i.e. you send the #signal[:]
messages to an instance of it, rather than a class as you do with the
Exception hierarchy). It is occassionally useful when you need to be able to
identify a specific exception to catch, but don't need any new or different
behaviour, and judge that the weight of a further class is not warranted.
Signal is not ANSI standard, but it is built on top of the ANSI standard
class-based Exception mechanism, I think using only ANSI protocols. Sending
#signal to a Signal instance actually raises an instance of the
<RaisedSignal> Exception, but Signal implements ANSI's <exceptionSelector>
protocol on its instance side to catch RaisedSignals).
Regards
Blair