Re: Q: Intermediate code for interpreting & compiling?

davidm@Rational.COM (David Moore)
Tue, 28 Feb 1995 01:55:20 GMT

          From comp.compilers

Related articles
Q: Intermediate code for interpreting & compiling? davis@wln.com (1995-02-10)
Re: Q: Intermediate code for interpreting & compiling? torbenm@diku.dk (1995-02-14)
Re: Q: Intermediate code for interpreting & compiling? cef@geodesic.com (Charles Fiterman) (1995-02-14)
Re: Q: Intermediate code for interpreting & compiling? danhicks@aol.com (1995-02-22)
Re: Q: Intermediate code for interpreting & compiling? Dave@occl-cam.demon.co.uk (Dave Lloyd) (1995-02-24)
Re: Q: Intermediate code for interpreting & compiling? zmola@cicero.spc.uchicago.edu (1995-02-24)
Re: Q: Intermediate code for interpreting & compiling? davidm@Rational.COM (1995-02-28)
Re: Q: Intermediate code for interpreting & compiling? anton@mips.complang.tuwien.ac.at (1995-03-01)
Re: discussion of thunks chase@centerline.com (1995-03-03)
| List of all articles for this month |

Newsgroups: comp.compilers
From: davidm@Rational.COM (David Moore)
Keywords: code, design, comment
Organization: Rational Software Corporation
References: 95-02-183
Date: Tue, 28 Feb 1995 01:55:20 GMT

>After an article by Dan Hicks, our moderator wrote...
>> [Hey, lots of languages have thunks. But now we call them function pointers.
>> -John]


Dave Lloyd <Dave@occl-cam.demon.co.uk> responded:
>Sorry, but I beg to differ. A function pointer is *not* a thunk. [...]


To which John remarked:


>[You can certainly implement the effect of thunks using function pointers. By
>the way, did you know that the original impetus for thunks, Algol60 call by
>name, was a mistake? It was supposed to be call by reference. -John]


And I now quibble:


I would tend to not believe that without a reference. Was not the intent to
produce a calling mechanism that was easy to understand - namely
textual substitution?


One also has to be careful about saying that one can implement thunks as
function pointers. The thunk executes in the context of the calling procedure.
This requires that a function pointer be bound with context rather than
just the address of the function to be called. This can't be done in C,
for example, in any reasonable way (setjmp anyone?).
[Re the quibble, Alan Perlis, who wrote the Algol60 report, told me so
himself. He was my thesis advisor. The point about the calling
function's context is a good one; you can address that in a
straightforward if clumsy way by making a structure with the addresses of
the locals referenced by the thunk along with the function pointer. -John]
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.