Re: Is multi-level function return possible?

Andy Walker <news@cuboid.co.uk>
Sun, 16 Mar 2014 19:45:44 +0000

          From comp.compilers

Related articles
[18 earlier articles]
Re: Is multi-level function return possible? ian@airs.com (Ian Lance Taylor) (2014-03-14)
Re: Is multi-level function return possible? DrDiettrich1@aol.com (Hans-Peter Diettrich) (2014-03-15)
Re: Is multi-level function return possible? usenet@bitblocks.com (Bakul Shah) (2014-03-15)
Re: Is multi-level function return possible? noitalmost@cox.net (noitalmost) (2014-03-15)
Re: Is multi-level function return possible? anton@mips.complang.tuwien.ac.at (2014-03-16)
Re: Is multi-level function return possible? marcov@toad.stack.nl (Marco van de Voort) (2014-03-16)
Re: Is multi-level function return possible? news@cuboid.co.uk (Andy Walker) (2014-03-16)
Re: Is multi-level function return possible? yaldnif.w@blueyonder.co.uk (Bill Findlay) (2014-03-17)
Re: Is multi-level function return possible? anton@mips.complang.tuwien.ac.at (2014-03-18)
Re: Is multi-level function return possible? news@cuboid.co.uk (Andy Walker) (2014-03-21)
Re: Is multi-level function return possible? gah@ugcs.caltech.edu (glen herrmannsfeldt) (2014-03-21)
Re: design of PL/I, was Is multi-level function return possible? gah@ugcs.caltech.edu (glen herrmannsfeldt) (2014-03-21)
Re: Is multi-level function return possible? anton@mips.complang.tuwien.ac.at (2014-03-24)
[9 later articles]
| List of all articles for this month |
From: Andy Walker <news@cuboid.co.uk>
Newsgroups: comp.compilers
Date: Sun, 16 Mar 2014 19:45:44 +0000
Organization: Not very much
References: 14-03-020 14-03-022 14-03-025 14-03-030 14-03-044
Keywords: Pascal, code
Posted-Date: 17 Mar 2014 11:49:40 EDT

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.


Post a followup to this message

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