From: Tayssir John Gabbour
Subject: Condition system discussions
Date: 
Message-ID: <866764be.0403020028.35250e18@posting.google.com>
Does anyone happen to know some text or link that talks interestingly
about the condition system?  So far I've found Kent Pitman's writings
and Peter Seibel's chapter-in-progress.  Graham's ACL book has a
useful reference, but that's about it.  Other sources I've looked
through say little about the topic.

I would think that conditions would sorta be a crown jewel of lisp. 
So I'm interested in what people think works, what stuff appeared to
be more fragile than one thought, etc.  Anything really.

Thank you in advance.

From: David Steuber
Subject: Re: Condition system discussions
Date: 
Message-ID: <m2k722d84z.fsf@david-steuber.com>
I don't really see how it is different from

if ()
else if ()
else if ()
...
else

-- 
Those who do not remember the history of Lisp are doomed to repeat it,
badly.
From: Rahul Jain
Subject: Re: Condition system discussions
Date: 
Message-ID: <87ptbuocdb.fsf@nyct.net>
David Steuber <·············@verizon.net> writes:

[About conditions:]

> I don't really see how it is different from
>
> if ()
> else if ()
> else if ()
> ...
> else

1. It has object-oriented dispatch. Do you use the same argument against
OOP?

2. The handlers are executed at the POINT of the error.

3. Handlers shadow and can defer to the shadowed handler.

4. Handlers can inspect restarts and invoke any available one, installed
by any code in the dynamic environment.

-- 
Rahul Jain
·····@nyct.net
Professional Software Developer, Amateur Quantum Mechanicist
From: Tayssir John Gabbour
Subject: Re: Condition system discussions
Date: 
Message-ID: <866764be.0403022311.4f2988c1@posting.google.com>
David Steuber <·············@verizon.net> wrote in message news:<··············@david-steuber.com>...
> I don't really see how it is different from
> 
> if ()
> else if ()
> else if ()
> ...
> else

Hmm, I'm assuming you've got a dry sense of humor, but maybe I should
have said "conditions system."  With the s at the end of the first
word.  The thing we can't call an errorhandling system, despite
sounding like we're talking about cond.

Maybe they should rename it the "interesting situations system."  Or
"mindgames with the stack."  I occasionally wonder if things like this
are a big Screw You to lisp implementors, who might want to play loose
with the stack.
From: Lars Brinkhoff
Subject: Re: Condition system discussions
Date: 
Message-ID: <85ptbue705.fsf@junk.nocrew.org>
David Steuber <·············@verizon.net> writes:
> I don't really see how it is different from
> 
> if ()
> else if ()
> else if ()
> ...
> else

You may be confusing conditions with cond.

-- 
Lars Brinkhoff,         Services for Unix, Linux, GCC, HTTP
Brinkhoff Consulting    http://www.brinkhoff.se/
From: David Steuber
Subject: Re: Condition system discussions
Date: 
Message-ID: <m28yihcwrt.fsf@david-steuber.com>
Lars Brinkhoff <·········@nocrew.org> writes:

> David Steuber <·············@verizon.net> writes:
> > I don't really see how it is different from
> > 
> > if ()
> > else if ()
> > else if ()
> > ...
> > else
> 
> You may be confusing conditions with cond.

My bad.  Or I could go with that dry humor excuse.

Another fun wordism I run into while reading about lisp is cdr.  I
sort of sound things out in my head when I read them (my lips don't
move though).  The problem comes with the cadr word.

-- 
Those who do not remember the history of Lisp are doomed to repeat it,
badly.

> (dwim x)
NIL
From: Barry Margolin
Subject: Re: Condition system discussions
Date: 
Message-ID: <barmar-B84426.00495304032004@comcast.ash.giganews.com>
In article <··············@david-steuber.com>,
 David Steuber <·············@verizon.net> wrote:

> Another fun wordism I run into while reading about lisp is cdr.  I
> sort of sound things out in my head when I read them (my lips don't
> move though).  The problem comes with the cadr word.

CDR is pronounced "could-er", CADR is pronounced "cadder".

-- 
Barry Margolin, ······@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
From: David Steuber
Subject: Re: Condition system discussions
Date: 
Message-ID: <m2fzcobu9y.fsf@david-steuber.com>
Barry Margolin <······@alum.mit.edu> writes:

> In article <··············@david-steuber.com>,
>  David Steuber <·············@verizon.net> wrote:
> 
> > Another fun wordism I run into while reading about lisp is cdr.  I
> > sort of sound things out in my head when I read them (my lips don't
> > move though).  The problem comes with the cadr word.
> 
> CDR is pronounced "could-er", CADR is pronounced "cadder".

That helps.  Is that with or without a Boston accent?

Now I just have to kill the old habbit.

-- 
Those who do not remember the history of Lisp are doomed to repeat it,
badly.

> (dwim x)
NIL
From: Barry Margolin
Subject: Re: Condition system discussions
Date: 
Message-ID: <barmar-90654D.12330404032004@comcast.ash.giganews.com>
In article <··············@david-steuber.com>,
 David Steuber <·············@verizon.net> wrote:

> Barry Margolin <······@alum.mit.edu> writes:
> 
> > In article <··············@david-steuber.com>,
> >  David Steuber <·············@verizon.net> wrote:
> > 
> > > Another fun wordism I run into while reading about lisp is cdr.  I
> > > sort of sound things out in my head when I read them (my lips don't
> > > move though).  The problem comes with the cadr word.
> > 
> > CDR is pronounced "could-er", CADR is pronounced "cadder".
> 
> That helps.  Is that with or without a Boston accent?

Most of the Lispers I've known have not been Boston natives, so the R's 
were always pronounced :)

-- 
Barry Margolin, ······@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
From: Tayssir John Gabbour
Subject: Re: Condition system discussions
Date: 
Message-ID: <866764be.0403072224.7200eca3@posting.google.com>
···········@yahoo.com (Tayssir John Gabbour) wrote in message news:<····························@posting.google.com>...
> Does anyone happen to know some text or link that talks interestingly
> about the condition system?  So far I've found Kent Pitman's writings
> and Peter Seibel's chapter-in-progress.  Graham's ACL book has a
> useful reference, but that's about it.  Other sources I've looked
> through say little about the topic.

Actually, it seems maybe my question should have been more general --
is there something that talks interestingly about dynamic
communication between functions, parallel to the stack?  Regardless of
language, but in a way that's of interest to a programmer.

It would seem that functions have deficiencies that need to be fixed
with this type of communication.  (Or functions are so powerful they
should have support to maximize them.)  Since languages such as
Haskell have "implicit parameters," and almost everything now has
exceptions, one would think this is a well-studied thing.
From: Rahul Jain
Subject: Re: Condition system discussions
Date: 
Message-ID: <8765dfltjf.fsf@nyct.net>
···········@yahoo.com (Tayssir John Gabbour) writes:

> It would seem that functions have deficiencies that need to be fixed
> with this type of communication.  (Or functions are so powerful they
> should have support to maximize them.)  Since languages such as
> Haskell have "implicit parameters," and almost everything now has
> exceptions, one would think this is a well-studied thing.

If I understand you, all you need to do is use defvar/defparameter to
define this variable and bind it with LET when you want. It will be
dynamically bound, and in threaded lisps, these bindings will not
interfere with other threads. It is well studied, but considered rather
basic and is used in many parts of the standard language, most notably
the printer and reader (where its use could actually be considered to be
a suboptimal solution, with the parameters being defined in the stream
itself being preferable).

Exceptions are a different issue, but I think that was handled (pun
intended!) in other responses, unless I'm mixing up contexts here. In
any case, if you're looking for blow-up-the-stack "exceptions" like in
C++ or Java, look at the _control-flow_ operators THROW and CATCH. They
are usually not used in the context of exceptional situations in lisp,
with closures around GO being a more common way of restarting an
operation at or aborting an operation to a defined exit point. THROW and
CATCH are typically used when you have some complex recursion and want
to immediately return some result, for example, in a search. This is
similar to the use of RETURN(-FROM) being used to abort complex
iterations.

-- 
Rahul Jain
·····@nyct.net
Professional Software Developer, Amateur Quantum Mechanicist