From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,37680a99b5e22b2b X-Google-Attributes: gid103376,public From: bobduff@world.std.com (Robert A Duff) Subject: Re: Shared Generic Instance Code Date: 1997/04/05 Message-ID: #1/1 X-Deja-AN: 230807349 References: <5hrkhkINN9ip@snoopy.cis.ohio-state.edu> <01bc4155$221728e0$2dfb82c1@xhv46.dial.pipex.com> Organization: The World Public Access UNIX, Brookline, MA Newsgroups: comp.lang.ada Date: 1997-04-05T00:00:00+00:00 List-Id: In article <01bc4155$221728e0$2dfb82c1@xhv46.dial.pipex.com>, Nick Roberts wrote: >Don't get confused between 'thunking' and mere indirect jumping/calling. A >thunk is where a direct jump/call vector is replaced at runtime (and is >thus a one-time thing per execution). I don't think that's right. I once spoke with Mike Woodger about this (around 1992 or so). He was involved in the original Algol 60, and I think that's where the term "thunk" originated. Algol 60 has call-by-name, so if you pass a parameter to a procedure, let's say the formal is X, and the actual is A[I], then "Y := X;" reevaluates the value of A[I], and "X := Y" reevaluates the address of A[I]. Note that I might have changed in the meantime, or might be a function call that returns different results each time. My understanding is that the "thunk" was a *pair* of pointers-to-procedures, used to implement call-by-name. One procedure for getting the value, and one for getting the address, of the actual parameter. I believe the term "thunk" then mutated, to mean a *single* procedure, when passed (implicitly) as a parameter, by a compiler, to implicitly implement some feature of a programming language. That's how *I* used the term. I admit that it's a bastardization of the original usage, as explained to me by Woodger. Your usage of the term, as poking the called-address of a call instruction (or jump instruction) is not familiar to me. Do you have any references that use it that way? Let's hear some etymology for your use of the term. Woodger was not sure where the term came from, but he thought it might have been the past tense of "think", as in, the compiler is generating a piece of code that does the "thinking" about where the actual parameter is (two pieces of code, actually), so the "thinking has been thunk." He had another theory about it, which I've forgotten. I could look it up, but that would involve digging into deep stacks of paper long since buried in the back corners of my office. ;-) I think it had to do with the sound "thunk" which was made by something-or-other. >...I think what you are suggesting is >just passing in jump/call vectors, which would be jumped/called to by an >indirect jump/call instruction. The vectors could change (by being passed >in as hidden parameters) for each instantiation. That's exactly what I'm suggesting (except that it would always be a call, never a jump). Is it wrong to call that a "thunk"? Etymology is fun. :-) - Bob P.S. It just occurred to me to look up "thunk" in "The Hacker's Dictionary", edited by Eric Raymond, foreward and cartoons by Guy Steele, Jr. It says: "1. A piece of coding which provides an address". And various other stuff which I don't feel like typing in. Definitions 1 and 2 match what I'm saying; definition 3 matches what you're saying. And then it has a "Historical note" that more-or-less matches what I said above about past-tense-of-think, and also, the sound "thunk". Interesting. I guess we're both right.