thunk

Sep 18, 2003 02:47

Today I learned about thunks.

They are first-class instructions packaged as functions in a functional language.

cs, programming

Leave a comment

Comments 3

yonked September 18 2003, 00:11:48 UTC
yes! cool name, cool thing. :)

Reply

cola_fan September 18 2003, 20:45:10 UTC
what blows my mind is that if you have side effects in your semantic actions, it is best to collect first a parse tree of thunks, then on a correct parse you execute the megathunk which explodes and reproduces a syntax tree.

Reply


anonymous October 24 2003, 13:03:12 UTC
Thunks are actually generalized across programming language theory, and I believe the term came about with the advent of Algol 60. Originally, it referred to the scratch space allocated by a compiler to compute expressions provided as formal parameters. In compilers, we referred to it as anything providing a return address following a jump, although this conflicts with the definition we used in comparison of programming languages.

These days, I'd feel comfortable using it to refer to any space allocated for an expression which may or may not be evaluated.

Thank for inviting me to soup night :/.

-Nick

Reply


Leave a comment

Up