ldo@waikato.ac.nz (Lawrence D'Oliveiro, Waikato University) (01/21/91)
kers@hplb.hpl.hp.com (Chris Dollin)'s comments in KERS.91Jan11090533@cdollin.hpl.hp.com> on closures and the lambda-calculus really bring back some memories from my earliest readings in computer science. Is there anybody else left in the world who thinks closures are a pretty neat idea, and a damned (pardon my French) useful programming technique? The only surviving language I know of that implements a proper closure facility is POP-11. Some LISP hackers seem to think they've got closures too, but they haven't--all they've got is an almost-as-useful kludge that requires call frames to be allocated on the heap. These days, I do most of my programming in von-Neumann-like languages like Modula-2. Even here it's possible to implement closures, by stepping outside the language slightly. It involves knowing the machine-specific conventions for passing arguments. It also helps if your compiler lets you insert machine code in-line. 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
oz@yunexus.yorku.ca (Ozan Yigit) (01/22/91)
In article <1991Jan21.120628.2749@waikato.ac.nz> ldo@waikato.ac.nz (Lawrence D'Oliveiro, Waikato University) writes: >Is there anybody else left in the world who thinks closures are >a pretty neat idea, and a damned (pardon my French) useful programming >technique? I would think that the entire Scheme community may be more than just anybody, for example. ;-) >... Some LISP hackers seem to think they've got >closures too, but they haven't--all they've got is an almost-as-useful >kludge that requires call frames to be allocated on the heap. I do not know what you mean by almost-as-useful, as you are not specific as to what is missing from, say scheme closures. The call frames are not required to be on the heap at all times, they can be moved there when necessary. (see [1] for example) oz --- [1] William D. Clinger, Anne H. Hartheimer and Eric M. Ost, Implementation Strategies for Continuations, Conference Record of the 1988 ACM Conference on Lisp and Functional Programming, August 1988, 124 131. --- We only know ... what we know, and | Internet: oz@nexus.yorku.ca that is very little. -- Dan Rather | UUCP: utzoo/utai!yunexus!oz
jeff@aiai.ed.ac.uk (Jeff Dalton) (01/29/91)
In article <1991Jan21.120628.2749@waikato.ac.nz> ldo@waikato.ac.nz (Lawrence D'Oliveiro, Waikato University) writes: >The only surviving language I know of that implements a proper >closure facility is POP-11. Some LISP hackers seem to think they've got >closures too, but they haven't--all they've got is an almost-as-useful >kludge that requires call frames to be allocated on the heap. Not so. First, you are assuming a particular definition of "closure" that does too much violence to current usage. Scheme, for example, has lexical closures, and this is a perfectly reasonable and not at all improper use of "closure". Other dialects of Lisp have dynamic closures (Lisp 1.5) or closures where the variables to close over are listed explicitly (Lisp Machine Lisp, Franz). Second, if you think that every function call has to do some heap allocation in Lisp, you are mistaken. What Pop has is "frozen formals". There may well not be any other language that has exactly that facility, but it is not too hard to add an equivalent to Lisp. (Where the discussion usually goes at this point is that the Pop ideologue starts to list other aspects of Pop -- uses of closures, if you will -- that aren't so easy to duplicate.) However, if you want to maintain your "proper closure" claim above, please give us some evidence that yours really is the proper definition (and tell us what your definition is while you're at it). (Sigh. Why are some Pop fans so committed to atacking (and misrepresenting) Lisp? From the Scheme point of view, what Pop has might well be called a hack to make up for the lack of proper closures, and one could point out many cases where the Scheme facility is more useful. I would certainly be annoyed at having to list the formals to freeze every time I made a closure. But, fortunately, the Scheme folk don't try to insist that there is but one proper notion of closure in the world.)