call-by-name

call-by-name

(reduction)(CBN) (Normal order reduction, leftmost, outermostreduction). An argument passing convention (first providedby ALGOL 60?) where argument expressions are passedunevaluated. This is usually implemented by passing a pointerto a thunk - some code which will return the value of theargument and an environment giving the values of its free variables.

This evaluation strategy is guaranteed to reach a normal form if one exists.

When used to implement functional programming languages,call-by-name is usually combined with graph reduction toavoid repeated evaluation of the same expression. This isthen known as call-by-need.

The opposite of call-by-name is call-by-value wherearguments are evaluated before they are passed to a function.This is more efficient but is less likely to terminate in thepresence of infinite data structures and recursivefunctions.

Arguments to macros are usually passed using call-by-name.