|Q: Intermediate code for interpreting & compiling? email@example.com (1995-02-10)|
|Re: Q: Intermediate code for interpreting & compiling? firstname.lastname@example.org (1995-02-14)|
|Re: Q: Intermediate code for interpreting & compiling? email@example.com (Charles Fiterman) (1995-02-14)|
|Re: Q: Intermediate code for interpreting & compiling? firstname.lastname@example.org (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? email@example.com (1995-02-24)|
|Re: Q: Intermediate code for interpreting & compiling? davidm@Rational.COM (1995-02-28)|
|Re: Q: Intermediate code for interpreting & compiling? firstname.lastname@example.org (1995-03-01)|
|Re: discussion of thunks email@example.com (1995-03-03)|
|From:||davidm@Rational.COM (David Moore)|
|Keywords:||code, design, comment|
|Organization:||Rational Software Corporation|
|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.
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
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]
Return to the
Search the comp.compilers archives again.