Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!uunet!mcsun!hp4nl!kunivv1!ge From: ge@kunivv1.sci.kun.nl (Ge' Weijers) Newsgroups: comp.object Subject: Re: Continuations Message-ID: <581@kunivv1.sci.kun.nl> Date: 12 Dec 89 16:01:39 GMT References: <2664@bingvaxu.cc.binghamton.edu> <9624@pyr.gatech.EDU> <1623@odin.SGI.COM> <1989Nov28.183816.15252@odi.com> <9964@june.cs.washington.edu> <34657@cornell.UUCP> <48742@ricerca.UUCP> Organization: University of Nijmegen, The Netherlands. Lines: 38 chase@Ozona.orc.olivetti.com (David Chase) writes: >However, the languages listed differ in their treatment of nested >procedures: >C forbids them (no closures). >Pascal allows them, but (in Pascal Classic, at least) forbids > their assignment to variables, use as parameters to > procedures, or use in a RETURN. (no closures, because it > turns out that a display can be used). Not quite true, in the original Pascal procedures were allowed as parameters, though type-safety goes out of the window, as the parameters were not indicated. PROCEDURE example (PROCEDURE error); BEGIN IF NOT (assertion) THEN error(4711); END example; I believe something like this was actually legal. In more current versions of the language the procedure must be typed. mr. Wirth probably did not dare to throw away the Algol-60 call by name at the time, as some people thought is was useful. They still are. >Modula-3 allows them, but forbids their assignment to variables or > their use in a RETURN. (closures needed, but must obey > stack lifetime rules). (I hope this example isn't too > obscure -- I'm rather familiar with it at the moment). Just like in Algol 68. Only the lifetime rule was very tricky there: the lifetime of a procedure is the lifetime of the 'youngest' non-local name accessed. The lifetime of a function not referencing any globals was therefore infinite, whereever it was declared. Ge' Weijers Internet/UUCP: ge@cs.kun.nl Faculty of Mathematics and Computer Science, (uunet.uu.net!cs.kun.nl!ge) University of Nijmegen, Toernooiveld 1 6525 ED Nijmegen, the Netherlands tel. +3180612483 (UTC-2)