*** Welcome to piglix ***

Call by name


A programming language uses an evaluation strategy to determine when to evaluate the argument(s) of a function call (for function, also read: operation, method, or relation) and what kind of value to pass to the function. For example, call by value/call by reference specifies that a function application evaluates the argument before it proceeds to the evaluation of the function's body and that it passes two capabilities to the function, namely, the ability to look up the current value of the argument and to modify it via an assignment statement. The notion of reduction strategy in lambda calculus is similar but distinct.

In practical terms, many modern programming languages have converged on a call-by-value/call-by-reference evaluation strategy for function calls (C#, Java). Some languages, especially lower-level languages such as C++, combine several notions of parameter passing. Historically, call by value and call by name date back to ALGOL 60, a language designed in the late 1950s. Call by reference is used by PL/I and some Fortran systems. Purely functional languages like Haskell, as well as non-purely functional languages like R, use call by need.

The evaluation strategy is specified by the programming language definition, and is not a function of any specific implementation.

In strict evaluation, the arguments to a function are always evaluated completely before the function is applied.

Under Church encoding, eager evaluation of operators maps to strict evaluation of functions; for this reason, strict evaluation is sometimes called "eager". Most existing programming languages use strict evaluation for functions.

Applicative order (or leftmost innermost) evaluation refers to an evaluation strategy in which the arguments of a function are evaluated from left to right in a post-order traversal of reducible expressions (). Applicative order is a call-by-value evaluation.


...
Wikipedia

...