[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: throw-catch :cancel



In article <3qv9e6$m4@Yost.com> yost@Yost.com (Dave Yost) writes:
>In article <v02110105abf8da609000@[198.112.74.171]>,
>>I've previously expressed the opinion that handling the cancel button on
>>dialogs by doing a throw to :cancel is just a bad idea.  It should signal a
>>condition, just like anything else.  This would allow the user to use a
>>global condition handler instead of a stack-based one which wouldn't be
>>applicable when the event is handled in another process.

The CL condition system doesn't have global condition handlers, only
stack-based ones.  Then again, CL doesn't have multiple threads, either; I
suppose an implementation that adds one could add the other as well.

Symbolics CL has global handlers, but I found that they were difficult to
use.  What if two applications both try to establish a global handler for
the same condition?

>Is the more general statement true?
>Are throw/catch obsoleted by conditions in general?

Conditions can be considered a generalization of throw/catch.  The tags in
catch and throw have to match exactly, while conditions use a hierarchy of
condition classes; thus, a handler for ERROR can catch a signal of
TYPE-ERROR.

In fact, conditions can (and often *are*) implemented using catch and
throw.
-- 
Barry Margolin
BBN Planet Corporation, Cambridge, MA
barmar@{bbnplanet.com,near.net,nic.near.net}
Phone (617) 873-3126 - Fax (617) 873-5124