Re: Is multi-level function return possible?

glen herrmannsfeldt <gah@ugcs.caltech.edu>
Fri, 14 Mar 2014 21:47:05 +0000 (UTC)

          From comp.compilers

Related articles
[10 earlier articles]
Re: Is multi-level function return possible? gneuner2@comcast.net (George Neuner) (2014-03-14)
Re: Is multi-level function return possible? gneuner2@comcast.net (George Neuner) (2014-03-14)
Re: Is multi-level function return possible? marcov@toad.stack.nl (Marco van de Voort) (2014-03-14)
Re: Is multi-level function return possible? gah@ugcs.caltech.edu (glen herrmannsfeldt) (2014-03-14)
Re: Is multi-level function return possible? kaz@kylheku.com (Kaz Kylheku) (2014-03-14)
Re: Is multi-level function return possible? kaz@kylheku.com (Kaz Kylheku) (2014-03-14)
Re: Is multi-level function return possible? gah@ugcs.caltech.edu (glen herrmannsfeldt) (2014-03-14)
Re: Is multi-level function return possible? marcov@toad.stack.nl (Marco van de Voort) (2014-03-14)
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)
[14 later articles]
| List of all articles for this month |

From: glen herrmannsfeldt <gah@ugcs.caltech.edu>
Newsgroups: comp.compilers
Date: Fri, 14 Mar 2014 21:47:05 +0000 (UTC)
Organization: Aioe.org NNTP Server
References: 14-03-020 14-03-022 14-03-031
Keywords: Pascal, history, comment
Posted-Date: 14 Mar 2014 18:01:51 EDT

George Neuner <gneuner2@comcast.net> wrote:
> On Tue, 11 Mar 2014 13:04:57 GMT, anton@mips.complang.tuwien.ac.at
> (Anton Ertl) wrote:


>>... in Pascal you can goto a label that is in a containing procedure
>>or function, even across several levels. That is a very rarely used
>>feature of the language, and Wirth removed it (along with goto) from
>>his later languages.


> Interesting. I was not aware of this, and it is not mentioned in any
> of several Pascal books I have from the early 80's. Other than
> Wirth's own, I wonder how many implementations actually allowed it?


As I remember it, Pascal allows GOTO out of an internal procedure.
That might not look so significant in the book, but, especially in
the case of recursion, it gets interesting when you have to implement
it.


Some of the programs that go along with TeX use it, I believe DVItype
being one. Some years ago, I translated one to C, and so used
longjmp() for the first, and probably last, time. (That was not so
long after I started working with C.)


TeX and associated programs were originally all in Pascal, but using
Knuth's preprocessor to make them more readable, what he calls
Literate Programming. Among other features that he discusses, is that
Pascal GOTO uses numeric labels, apparently to discourage their use.
Part of Literate Programming is to use alphanumeric, more descriptive
labels. But as with many GOTO statements, the usual use is getting out
in the case of a fatal error, even from nested procedure calls.


In addition to what Pascal allows, C's longjmp() and PL/I with LABEL
variables, allow run-time selection of targets. That is, with a
variable instead of a compile-time constant label.


-- glen
[I thought the numeric labels were to look like Fortran. -John]


Post a followup to this message

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