Subject: Re: Alogl thunks [was Re: copying a vector? (Stalin 0.9?)]
From: rpw3@rigden.engr.sgi.com (Rob Warnock)
Date: 6 Jan 2001 11:12:33 GMT
Newsgroups: comp.lang.scheme
Message-ID: <936uj1$lbm1n$1@fido.engr.sgi.com>
Will Clinger - Sun Microsystems  <william.clinger@east.sun.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)
| environment.
+---------------

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.


-Rob

[*] 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		rpw3@sgi.com
SGI Network Engineering		http://reality.sgi.com/rpw3/
1600 Amphitheatre Pkwy.		Phone: 650-933-1673
Mountain View, CA  94043	PP-ASEL-IA