Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!us.feeder.erje.net!news.linkpendium.com!news.linkpendium.com!news.iecc.com!.POSTED!nerds-end From: anton@mips.complang.tuwien.ac.at (Anton Ertl) Newsgroups: comp.compilers Subject: Re: Is multi-level function return possible? Date: Tue, 18 Mar 2014 17:36:46 GMT Organization: Institut fuer Computersprachen, Technische Universitaet Wien Lines: 41 Sender: news@iecc.com Approved: comp.compilers@iecc.com Message-ID: <14-03-048@comp.compilers> References: <14-03-020@comp.compilers> <14-03-022@comp.compilers> <14-03-025@comp.compilers> <14-03-030@comp.compilers> <14-03-044@comp.compilers> <14-03-046@comp.compilers> <14-03-047@comp.compilers> NNTP-Posting-Host: news.iecc.com X-Trace: miucha.iecc.com 1395274348 77631 2001:470:1f07:1126:0:676f:7373:6970 (20 Mar 2014 00:12:28 GMT) X-Complaints-To: abuse@iecc.com NNTP-Posting-Date: Thu, 20 Mar 2014 00:12:28 +0000 (UTC) Keywords: Pascal, algol60, history Posted-Date: 19 Mar 2014 20:12:28 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:1170 Bill Findlay writes: >On 16/03/2014 19:45, "Andy Walker" wrote: > >> On 16/03/14 17:19, Anton Ertl wrote: >>> Language design note: Given that nested functions have fallen out of >>> favour in the Algol-family world (in C and its offspring), I wonder if >>> they only really gain usefulness when combined with first-class >>> closures. > >It would be wrong to imply that "the Algol-family world" consists of "C and >its offspring". Algol has many descendants that have have remained more >loyal to their family traditions, Ada 2012 first among them. True. But I find it more revealing what features were added back in after the C branch of the family went through the B bottleneck. Keeping a feature may just be loyalty, but adding it back after it had been removed says something about what the language designer thought about the usefulness of the feature. Ok, let's look at the arguments I have seen until now: Name management (information hiding, variable hiding): Languages like Modula-2 added additional mechanisms for that despite having nested procedures; C++ did not add nested functions, but did add name spaces. That argument is not very convincing to me. "Parameters have a run-time cost": So has access to non-local variables. Languages that put high priority on run-time cost like C and C++ did not add that feature (except GNU C), so this argument did not convince their designers. And it does not convince me. Hassle when converting Algol to C: I can believe that, but that does not tell me about the value of the feature in other contexts. Did I miss any arguments? - anton -- M. Anton Ertl anton@mips.complang.tuwien.ac.at http://www.complang.tuwien.ac.at/anton/