Re: catch and throw, was Is multi-level function return possible?

Kaz Kylheku <kaz@kylheku.com>
Thu, 27 Mar 2014 05:44:15 +0000 (UTC)

          From comp.compilers

Related articles
Is multi-level function return possible? noitalmost@cox.net (noitalmost) (2014-03-10)
Re: Is multi-level function return possible? gneuner2@comcast.net (George Neuner) (2014-03-11)
Re: Is multi-level function return possible? federation2005@netzero.com (2014-03-26)
Re: catch and throw, was Is multi-level function return possible? rpw3@rpw3.org (2014-03-27)
Re: catch and throw, was Is multi-level function return possible? kaz@kylheku.com (Kaz Kylheku) (2014-03-27)
Re: catch and throw, was Is multi-level function return possible? usenet@bitblocks.com (Bakul Shah) (2014-03-26)
Re: catch and throw, was Is multi-level function return possible? gah@ugcs.caltech.edu (glen herrmannsfeldt) (2014-03-27)
Re: catch and throw, was Is multi-level function return possible? gneuner2@comcast.net (George Neuner) (2014-03-28)
Re: catch and throw, was Is multi-level function return possible? acolvin@efunct.com (mac) (2014-03-28)
Re: catch and throw, was Is multi-level function return possible? ivan@ootbcomp.com (Ivan Godard) (2014-03-28)
Re: catch and throw, was Is multi-level function return possible? kaz@kylheku.com (Kaz Kylheku) (2014-03-29)
[4 later articles]
| List of all articles for this month |

From: Kaz Kylheku <kaz@kylheku.com>
Newsgroups: comp.compilers
Date: Thu, 27 Mar 2014 05:44:15 +0000 (UTC)
Organization: Aioe.org NNTP Server
References: 14-03-020 14-03-023 14-03-065 14-03-068
Keywords: history, errors
Posted-Date: 27 Mar 2014 14:54:11 EDT

On 2014-03-27, Rob Warnock <rpw3@rpw3.org> wrote:
> According to Gabriel and Steele in "The Evolution of Lisp"[1],
> 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.
> ...


Before this, Lisp-2, around 1965 or 1966, already had TRY and EXIT,
which looked like a predecessor to catch, and a close relative of this
ERRSET, while also hinting at unwind-protect also (although, in
contrast, unwind-protect doesn't serve as the ultimate termination
point of a control transfer, but only a "pit stop").


TRY went something like this:


    (TRY <var> <protected-statemenet> <cleanup-statement>)


TRY evaluates <protected-statement>. If an (EXIT <val>) does not occur
in that evaluation, then when <protected-statement> terminates, the
TRY terminates and control passes to whatever form is next.


If an (EXIT <val>) operation occurs in <protected-statement>, then
variable <var> is bound to the value <val>, and <cleanup-statement> is
executed in scope of that variable. The exit is thereby intercepted,
and control continues with whatever is next after the TRY.


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.