🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.modula2
Article #1703

Re: Nested routines as values?

#1703
From: Lawrence D'Oliveiro, Waikato Uni...
Date: Wed, 23 Jan 1991 20:39
18 lines
1519 bytes
Thanks to those people who correctly pointed out that a nested routine
needs some way to access local variables at the outer level, and who
mentioned the two well-known mechanisms for doing so. However, this
makes no difference to my point: there is still no need to pass such
a routine (as a value of a PROCEDURE type) in the form of a descriptor,
to allow such accesses to take place. You can do it with just an
address.

Certainly the onus is on the programmer to ensure that no references
to such an object remain around when the enclosing routine terminates.
The same thing applies to using the ADR function on a local variable,
and as I recall, Modula-2 includes no special types to enforce the
restriction in this case!

Lawrence D'Oliveiro                       fone: +64-71-562-889
Computer Services Dept                     fax: +64-71-384-066
University of Waikato            electric mail: ldo@waikato.ac.nz
Hamilton, New Zealand    37^ 47' 26" S, 175^ 19' 7" E, GMT+13:00
Technical Details
Message-ID: <1991Jan24.093958.2798@waikato.ac.nz>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!helios!bcm!dimacs.rutgers.edu!seismo!uunet!munnari.oz.au!uhccux!waikato.ac.nz!ldo
References: <1991Jan19.151918.2734@waikato.ac.nz> <22079@neptune.inf.ethz.ch>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!helios!bcm!dimacs.rutgers.edu!seismo!uunet!munnari.oz.au!uhccux!waikato.ac.nz!ldo
From: ldo@waikato.ac.nz (Lawrence D'Oliveiro, Waikato University)
Newsgroups: comp.lang.modula2
Subject: Re: Nested routines as values?
Message-ID: <1991Jan24.093958.2798@waikato.ac.nz>
Date: 23 Jan 91 20:39:58 GMT
References: <1991Jan19.151918.2734@waikato.ac.nz> <22079@neptune.inf.ethz.ch>
Organization: University of Waikato, Hamilton, New Zealand
Lines: 18