Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!news-out.readnews.com!news-xxxfer.readnews.com!news.misty.com!news.iecc.com!.POSTED!nerds-end From: Kaz Kylheku Newsgroups: comp.compilers Subject: Re: catch and throw, was Is multi-level function return possible? Date: Thu, 27 Mar 2014 05:44:15 +0000 (UTC) Organization: Aioe.org NNTP Server Lines: 28 Sender: news@iecc.com Approved: comp.compilers@iecc.com Message-ID: <14-03-069@comp.compilers> References: <14-03-020@comp.compilers> <14-03-023@comp.compilers> <14-03-065@comp.compilers> <14-03-068@comp.compilers> NNTP-Posting-Host: news.iecc.com X-Trace: miucha.iecc.com 1395946451 66645 2001:470:1f07:1126:0:676f:7373:6970 (27 Mar 2014 18:54:11 GMT) X-Complaints-To: abuse@iecc.com NNTP-Posting-Date: Thu, 27 Mar 2014 18:54:11 +0000 (UTC) Keywords: history, errors Posted-Date: 27 Mar 2014 14:54:11 EDT X-submission-address: compilers@iecc.com X-moderator-address: compilers-request@iecc.com X-FAQ-and-archives: http://compilers.iecc.com Xref: csiph.com comp.compilers:1191 On 2014-03-27, Rob Warnock 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 ) TRY evaluates . If an (EXIT ) does not occur in that evaluation, then when terminates, the TRY terminates and control passes to whatever form is next. If an (EXIT ) operation occurs in , then variable is bound to the value , and is executed in scope of that variable. The exit is thereby intercepted, and control continues with whatever is next after the TRY.