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: George Neuner Newsgroups: comp.compilers Subject: Re: catch and throw, was Is multi-level function return possible? Date: Fri, 28 Mar 2014 03:52:41 -0400 Organization: A noiseless patient Spider Lines: 49 Sender: news@iecc.com Approved: comp.compilers@iecc.com Message-ID: <14-03-074@comp.compilers> References: <14-03-020@comp.compilers> <14-03-023@comp.compilers> <14-03-065@comp.compilers> NNTP-Posting-Host: news.iecc.com Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Trace: miucha.iecc.com 1396019105 18205 2001:470:1f07:1126:0:676f:7373:6970 (28 Mar 2014 15:05:05 GMT) X-Complaints-To: abuse@iecc.com NNTP-Posting-Date: Fri, 28 Mar 2014 15:05:05 +0000 (UTC) Keywords: errors, history Posted-Date: 28 Mar 2014 11:05:05 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:1196 On Wed, 26 Mar 2014 17:39:25 -0700 (PDT), federation2005@netzero.com wrote: >On Tuesday, March 11, 2014 12:56:01 PM UTC-5, 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") [Note 1] notion is the >catch-throw paradigm. TouchC). However, the date of writing is part of the context of a missive, and I think people reading - and particularly responding to - anything found on the Internet needs to be aware of the post date. But this is off-topic here in comp.compilers. [Only sort of. I get mail from googlegroups users arguing with a message posted 20 years ago. -John] >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. My understanding was that CATCH/THROW originated with MacLisp, though IIRC it was roughly the same time (1971-72) as Prolog was introduced, so there may have been some cross-pollenization WRT syntax. In fact, MacLisp already had a non-local error exit form: ERRSET/ERR. CATCH/THROW was introduced as an alternative syntax specifically for non-error situations because programmers were abusing ERRSET/ERR for all kinds of non-local returns. >The idea may also be motivated, in part, by the Curry-Howard >isomorphism, which relates the "AND", "OR" and "IF-THEN" connectives >of Intuitionist logic respectively to the product, union and function >types. When the scope of the correspondence is extended to classical >logic, it connects Pierce's Rule to the catch-throw mechanism. Look >under the Wikipedia entry, for instance, which also points to the >call/cc mechanism of Scheme and to the related notion of continuation >passing. Very interesting! Thanks for the pointer. George