Related articles |
---|
[2 earlier articles] |
Re: How to implement lexical closures? gneuner2@comcast.net (George Neuner) (2010-05-09) |
Re: How to implement lexical closures? cr88192@hotmail.com (BGB / cr88192) (2010-05-09) |
Re: How to implement lexical closures? torbenm@diku.dk (2010-05-10) |
Re: How to implement lexical closures? grom358@gmail.com (grom) (2010-05-11) |
Re: How to implement lexical closures? cr88192@hotmail.com (BGB / cr88192) (2010-05-12) |
Re: How to implement lexical closures? gene.ressler@gmail.com (Gene) (2010-05-12) |
Re: How to implement lexical closures? gah@ugcs.caltech.edu (glen herrmannsfeldt) (2010-05-13) |
Re: How to implement lexical closures? gneuner2@comcast.net (George Neuner) (2010-05-15) |
Re: How to implement lexical closures? gneuner2@comcast.net (George Neuner) (2010-05-15) |
Re: How to implement lexical closures? gah@ugcs.caltech.edu (glen herrmannsfeldt) (2010-05-16) |
Re: How to implement lexical closures? gneuner2@comcast.net (George Neuner) (2010-05-17) |
Re: How to implement lexical closures? cfc@shell01.TheWorld.com (Chris F Clark) (2010-05-17) |
Re: PL/I, was How to implement lexical closures? genew@ocis.net (Gene Wirchenko) (2010-05-17) |
[2 later articles] |
From: | glen herrmannsfeldt <gah@ugcs.caltech.edu> |
Newsgroups: | comp.compilers |
Date: | Thu, 13 May 2010 19:52:58 +0000 (UTC) |
Organization: | Aioe.org NNTP Server |
References: | 10-05-031 10-05-072 |
Keywords: | storage,symbols |
Posted-Date: | 14 May 2010 10:25:21 EDT |
Gene <gene.ressler@gmail.com> wrote:
(snip)
> A closure is a pair consisting of code and an activation record. The
> activation record is an array of slots for values of parameters (and
> local variables if your language has them). In lanuages like yours
> with lexical nesting, there will also be a frame pointer to the
> activation record of the lexically enclosing scope.
I never actually tried writing code like that, so I am not
so sure I understand closures. I do know the problem that
comes up in PL/I with ENTRY variables. (Similar to C function
pointers, but PL/I allows internal procedures. In the case
of recursion, for example, you get the activation record at
the time of the call. Because of this complication, Fortran
(as of 2003, and I believe 2008) doesn't allow the use of an
internal procedure name as an actual argument.
But maybe I am still not so sure. As you say, "consisting
of code and an activation record." Is "pointer to code"
good enough for that definition, or is it more than that?
I have never seen that PL/I ENTRY variable refered to as
a closure.
An even more interesting feature in PL/I is the use of
a LABEL variable pointing to a label in a different procedure
or a different activation level in the same procedure.
-- glen
Return to the
comp.compilers page.
Search the
comp.compilers archives again.