Skip to content

Why are they called thunks? #4

Answered by vito
matthewmueller asked this question in Q&A
Discussion options

You must be logged in to vote

Bass thunks have the following properties:

  • A thunk is a value representing a deferred (or lazy) computation (except it's a command to run in a container or a Bass module to evaluate, instead of a function body to evaluate).
  • A thunk is always fully defined, takes no additional parameters, and always has the same result.
  • A thunk's result can be cached forever (though it may still run again upon a cache miss/purge).

Note that these properties assume thunks are hermetic, i.e. they are are used as leverage to guide users towards hermetic builds.

These properties align with a 0-arity pure function, which Haskell calls a thunk, so I did too. I believe the most general definition of thunk is ju…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@matthewmueller
Comment options

Answer selected by matthewmueller
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants