Towards a better conceptual model of exceptions (Was: Re: The Right Approach to Exceptions)
H. S. Teoh
hsteoh at quickfur.ath.cx
Tue Feb 21 09:10:21 PST 2012
On Tue, Feb 21, 2012 at 06:01:09PM +0100, deadalnix wrote:
> Le 21/02/2012 17:56, H. S. Teoh a écrit :
> >The only thing I added, perhaps, is that instead of problem-specific
> >conditions, as they appear to have in Lisp, I'm looking at generic
> >categories of conditions, that you can handle from high-level code
> >without ever needing to know the specifics of exactly what the condition
> >is, and yet have the low-level code work it all out once you've made a
> About this, I did some sketching, and I think LISP guys may have
> outsmarted you.
> Let's consider a transiant condition. You can retry or give up and
> throw. But, if you want to retry or not often depend on what went
> wrong, no ?
True, and there's nothing to stop you from digging into the details of
the raised Condition if you want to. I did consider implementing
Conditions as some kind of class hierarchy, so that the generic
categories are at the top, underneath Condition, then actual specific
Conditions can extend them. If your handler knows of a specific
Condition, then you can access any pertinent additional info, and make
decisions based on that.
But what I wanted to know was, can you still do something meaningful
even if you knew nothing beyond the top-level generic categories of
Conditions? That way, your handler will still work with new Conditions
that you've never seen before.
Never trust an operating system you don't have source for! -- Martin Schulze
More information about the Digitalmars-d