Anvil | Smiths Smiths | Register Register | Login Login |
Search:
Show links Show tools Show tree | Previous document Next document | njet.org > Anvil > Documentation > Language reference > Expressions > Lazy expressions

Lazy expressions

A primary expression (or any other expression in parentheses) may be modified to be lazily evaluated. Instead of evaluating the expresssion on the spot, a thunk is created and returned.

This thunk reflects the return value of an expression, so that upon first use, its value is evaluated, stored, and returned.

Thunks are implemented as an anonymous nested function enclosed in the thunk ref.

  lazy-expr := "^" primary 
See also  | Expressions  | Grammar  | Info
Contributes notes:
Add a note
What's new | Anvil