Re: Is multi-level function return possible?

Andy Walker <news@cuboid.co.uk>
Fri, 21 Mar 2014 02:04:51 +0000

          From comp.compilers

Related articles
[21 earlier articles]
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)
Re: Is multi-level function return possible? gah@ugcs.caltech.edu (glen herrmannsfeldt) (2014-03-24)
Re: Is multi-level function return possible? gneuner2@comcast.net (George Neuner) (2014-03-26)
Re: Is multi-level function return possible? news@cuboid.co.uk (Andy Walker) (2014-03-26)
[6 later articles]
| List of all articles for this month |

From: Andy Walker <news@cuboid.co.uk>
Newsgroups: comp.compilers
Date: Fri, 21 Mar 2014 02:04:51 +0000
Organization: Not very much
References: 14-03-020 14-03-022 14-03-025 14-03-030 14-03-044 14-03-046 14-03-047 14-03-048
Keywords: design, history, comment
Posted-Date: 20 Mar 2014 22:24:55 EDT

On 18/03/14 17:36, Anton Ertl wrote:
> 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.


Well, it certainly implies that the designer [or the committee!]
is admitting to a mistake. *Not* adding it back in may be because the
feature really was useless, because the particular user base sees no
need for the feature, because the feature is too expensive, or because
of pig-headedness. I expect contributors could write long articles of
examples of each of these ....


[...]
> "Parameters have a run-time cost": So has access to non-local
> variables.


That depends on the machine and compiler. The first compiler I
used extensively [for Atlas Autocode] accessed variables at lexical
depth N by offsetting from register N, so all variables were accessed
at exactly the same cost. But that would have been difficult on a
machine with few registers.


[...]
> Did I miss any arguments?


Not so much an argument as a philosophy. You can ask about the
usefulness of a feature from several viewpoints. Is it needed? Is it
something the users want? Is it something they should want, or would
want if only they knew about it? Is it something that would attract
new users or new applications? Is it consonant with the rest of the
language? Is it easy to parse and to generate code for? Is it easy
to explain? Is it efficient? And so on. You seem to be approaching
your question from the point of view of a compiler writer; I'm more
interested in writing programs. Writing programs is itself a very
personal activity depending on experience and context, so different
people may perfectly reasonably have very different attitudes to any
particular feature.


In other words, "Are nested functions useful?" does not have
a clear and definite answer. They're useful to me [marginally so, and
there are things I would add to C more urgently, if urgency makes any
sense after 40-ish years]; I guess they'd be more useful to those with
a more Pascal-oriented background; they were clearly of very little
use to the designers of C and Unix, and by now to the many programmers
whose formative years were based around C and its derivatives. They
can be worked around; should we have to?


--
Andy Walker,
Nottingham.
[It occurs that a lot of the stuff people used to do with small
nested functions we now do with macros, or sometimes with complex
types that do dereferencing that used to need explicit code. -John]


Post a followup to this message

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