Will Clinger - Sun Microsystems <email@example.com> wrote:
| Rob Warnock wrote:
| > Well, the ALGOL-10 compiler for the DEC PDP-10 (~1970) used thunks
| > (their term) for the call-by-name argument accessor code fragments
| > they passed around, and IIRC (though it's been ~30yr, so I could
| > have it slightly wrong), those thunks weren't "on the stack", nor
| > were they "activation records" -- they were fixed code fragments
| > whose addresses were passed as arguments.
| A pointer to code isn't enough to represent an Algol thunk.
| An Algol thunk is a closure (actually a pair of closures,
| as Rob pointed out). That closure can be represented as a
| pointer to code along with a pointer to the (stack-allocated)
But as I said in another reply, I don't think it permitted full
closure *values*, just procedure args, so a simple frame pointer
(dynamic link) in the subroutine calling sequence was enough to
allow the thunks to access the caller's lexical context.
| Aside from the stack allocation of environment structures,
| and the fact that two thunks were needed (the second to
| deal with the semantics of assignment in Algol), I don't
| see much difference between an Algol thunk and the thunks
| of current functional languages.
Well, since you couldn't return procedures as values[*], lexical
scopes could never survive their dynamic extent, so you didn't
need full environments as we know them today.
[*] Looking at <URL:http://www.csse.monash.edu.au/~lloyd/tildeProgLang/
Algol60/RRA60.info>, the only types I can see a function can have are
"real", "integer", and "boolean" (though arguments can be of type
"procedure" or "<TYPE> procedure").
Rob Warnock, 31-2-510 firstname.lastname@example.org
SGI Network Engineering http://reality.sgi.com/rpw3/
1600 Amphitheatre Pkwy. Phone: 650-933-1673
Mountain View, CA 94043 PP-ASEL-IA