thunk


Also found in: Dictionary, Thesaurus, Idioms, Wikipedia.

thunk

[thəŋk]
(computer science)
An additional subprogram created by the compiler to represent the evaluation of the argument of an expression in the call-by-name procedure.
McGraw-Hill Dictionary of Scientific & Technical Terms, 6E, Copyright © 2003 by The McGraw-Hill Companies, Inc.

thunk

(programming)
/thuhnk/ 1. "A piece of coding which provides an address", according to P. Z. Ingerman, who invented thunks in 1961 as a way of binding actual parameters to their formal definitions in ALGOL 60 procedure calls. If a procedure is called with an expression in the place of a formal parameter, the compiler generates a thunk which computes the expression and leaves the address of the result in some standard location.

2. The term was later generalised to mean an expression, frozen together with its environment (variable values), for later evaluation if and when needed (similar to a "closure"). The process of unfreezing these thunks is called "forcing".

3. A stubroutine, in an overlay programming environment, that loads and jumps to the correct overlay.

Compare trampoline.

There are a couple of onomatopoeic myths circulating about the origin of this term. The most common is that it is the sound made by data hitting the stack; another holds that the sound is that of the data hitting an accumulator. Yet another suggests that it is the sound of the expression being unfrozen at argument-evaluation time. In fact, according to the inventors, it was coined after they realised (in the wee hours after hours of discussion) that the type of an argument in ALGOL 60 could be figured out in advance with a little compile-time thought, simplifying the evaluation machinery. In other words, it had "already been thought of"; thus it was christened a "thunk", which is "the past tense of "think" at two in the morning".

4. (Microsoft Windows programming) universal thunk, generic thunk, flat thunk.
This article is provided by FOLDOC - Free Online Dictionary of Computing (foldoc.org)

thunk

In a PC, to execute the instructions required to switch between segmented addressing of memory and flat addressing. A thunk typically occurs when a 16-bit application is running in a 32-bit address space, and its 16-bit segmented address must be converted into a full 32-bit flat address. On the other hand, if a 32-bit program calls a 16-bit DLL, then the thunk is in the opposite direction: from 32 bit to 16 bit.
Copyright © 1981-2019 by The Computer Language Company Inc. All Rights reserved. THIS DEFINITION IS FOR PERSONAL USE ONLY. All other reproduction is strictly prohibited without permission from the publisher.
References in periodicals archive ?
For Newbigging, being "thunk" is akin to being held prisoner by endless loops of negative content.
"A skunk sat on a stump and thunk the stump skunk--oops, I messed up already!" exclaimed Peter.
Who would have thunk? Frequent family dinners may help protect teens against illegal drug use and stress--and even help them do better in school, according to a study from the National Center on Addiction and Substance Abuse (CASA) at Columbia University.
This recording seems destined to become one of those "who'da thunk it?" classical cult best-sellers along the lines of the Nonesuch Gorecki Third Symphony.
From the innocuous "handicapped," "handicapper," and "disabled" to the more crass "gimp," "crip," and "cripple" to the ridiculous "differently-abled" (that some well-intended soul thunk up and earned $50,000 in a contest)--the PN staff has seen 'em, used 'em, or ignored 'em.
Here's one for the "Who'd a thunk it?" file: It turns out Congress can come up with a secrecy law that's too draconian for even John Ashcroft.
There is a true quality sound to the 'thunk' of the doors closing on a cabin where seating comfort has been prioritised, the driving position proving particularly noteworthy, recline and seat height adjust providing a supportive place to be, on long or short haul.
Who'da thunk the stuff was as toxic as toxic gets, and that today we'd be grappling with the legacy of mercury, not only in our fillings (where it now masquerades as "silver"), but also in our air, water, and the fish we eat?
Plop, thunk, gussshhh--it is the sound of rain that brings the toad to the surface to spawn; thus the life cycle continues.
We sat for 2 whole hours before we finally heard a "snap," followed by a "thunk!" It had to be a deer, so we sat silently, barely breathing.
The four of us walked back and got into our cars--thunk thunk thunk thunk--and started them up, took a last look over at this tiny but essential adjustment in the universe, and then drove away into our otherwise ordinary lives.
Of course there is also a "who would've thunk it!" section, headed by that prince of decadents, Oscar Wilde.