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: Andy Walker Newsgroups: comp.compilers Subject: Re: Is multi-level function return possible? Date: Sun, 16 Mar 2014 19:45:44 +0000 Organization: Not very much Lines: 20 Sender: news@iecc.com Approved: comp.compilers@iecc.com Message-ID: <14-03-046@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> NNTP-Posting-Host: news.iecc.com Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: miucha.iecc.com 1395071380 78241 2001:470:1f07:1126:0:676f:7373:6970 (17 Mar 2014 15:49:40 GMT) X-Complaints-To: abuse@iecc.com NNTP-Posting-Date: Mon, 17 Mar 2014 15:49:40 +0000 (UTC) Keywords: Pascal, code Posted-Date: 17 Mar 2014 11:49:40 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:1168 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. They are also useful for variable hiding and space reclamation. If all functions are at the outermost level, then they can only access local or global variables, and so can communicate with each other only via globals or parameters. Global space can never be reclaimed except through sophisticated optimisations, and parameters have a run-time cost. I assume that the designers of "C and its offspring" decided that the cost of single-level functions was outweighed by the relative ease of compilation and code generation. Whether that was a correct decision, I don't know, but it was a major hassle for me in the days when we had to convert a mass of Algol code to C. -- Andy Walker, Nottingham.