A parameterless closure (functional programming) or a function generated by a compiler to aid runtime linking with a dynamic library function.
- In functional programming, a thunk is an anonymous and parameterless function (closure), used to pass lazily evaluated expressions.
- In C++, a thunk is a compiler generated function which optimizes virtual function calls.
- On systems which support dynamic linking, a thunk is often automatically inserted to provide a place for the runtime linker to insert code for invoking the actual implementation found in a library.