|Is multi-level function return possible? email@example.com (noitalmost) (2014-03-10)|
|Re: Is multi-level function return possible? firstname.lastname@example.org (George Neuner) (2014-03-11)|
|Re: Is multi-level function return possible? email@example.com (2014-03-26)|
|Re: catch and throw, was Is multi-level function return possible? firstname.lastname@example.org (2014-03-27)|
|Re: catch and throw, was Is multi-level function return possible? email@example.com (Kaz Kylheku) (2014-03-27)|
|Re: catch and throw, was Is multi-level function return possible? firstname.lastname@example.org (Bakul Shah) (2014-03-26)|
|Re: catch and throw, was Is multi-level function return possible? email@example.com (glen herrmannsfeldt) (2014-03-27)|
|Re: exception catching in PL/I firstname.lastname@example.org (Robin Vowels) (2014-03-28)|
|Re: catch and throw, was Is multi-level function return possible? email@example.com (George Neuner) (2014-03-28)|
|Re: catch and throw, was Is multi-level function return possible? firstname.lastname@example.org (mac) (2014-03-28)|
|[10 later articles]|
|From:||email@example.com (Rob Warnock)|
|Date:||27 Mar 2014 04:23:12 GMT|
|Organization:||Rob Warnock, Consulting Systems Architect|
|References:||14-03-020 14-03-023 14-03-065|
|Keywords:||errors, Lisp, history, comment|
|Posted-Date:||27 Mar 2014 00:45:11 EDT|
|Originator:||firstname.lastname@example.org (Rob Warnock)|
| George Neuner wrote:
| > The modern term is "exception". See also "non-local" control
| > transfer, exit and/or return, and "escape" or "backtracking"
| > continuation.
| Right, the contemporary (not "modern") notion is the catch-throw
| paradigm. I like to think of it as the "cap and trap" mechanism.
| I believe it originates with Prolog in the 1970's, since (a) catch
| and throw are part of Prolog's library of built-in functions, and
| (b) the multi-level breakout has always been an integral part of
| its run-time system.
According to Gabriel and Steele in "The Evolution of Lisp",
Lisp 1.5 [early 1960s] had (ERRSET form), which:
...evaluates *form* in a context in which errors do not terminate
the program or enter the debugger. If *form* does not cause an
error, ERRSET returns a singleton list of the value. If execution
of *form* does cause an error, the ERRSET form quietly returns NIL.
MacLisp [late 1960s] added the function ERR, which signals an error.
If ERR is invoked within the dynamic context of an ERRSET form, then
the argument to ERR is returned as the value of the ERRSET form.
Programmers soon began to use ERRSET and ERR not to trap and signal
errors but for more general control purposes (dynamic non-local exits).
Unfortunately, this use of ERRSET also quietly trapped unexpected
errors, making programs harder to debug. A new pair of primitives,
CATCH and THROW, was introduced into MacLisp in June 1972 so that
ERRSET could be reserved for its intended use of error trapping
So unless Prolog's implementation predates June 1972, I would suggest
that Lisp has priority on CATCH/THROW.
The Evolution of Lisp
Guy L. Steele Jr. & Richard P. Gabriel
[Presented at the ACM/SIGPLAN Second History of
Programming Languages Conference, April 1993]
[Uncut version, contains ~32 pages of material
trimmed from conference version.]
Rob Warnock <email@example.com>
627 26th Avenue <http://rpw3.org/>
San Mateo, CA 94403
[I happen to have a copy of the LISP 1.5 Programmer's Manual, second
edition, in my hand, and while it says nothing about ERRSET, on page
35 it does describe a form called errorset that evaluates an
expression and returns a list of the expression's value if it worked,
or nil if there was an error. Page 32 alludes to an error form that
causes an error. Sure sounds like catch and throw to me, give or take
the problem that it also catches and ignores real errors. The book
was published in 1965. -John]
Return to the
Search the comp.compilers archives again.