|This (in-)famous parameter passing mode was introduced
as the default mode in Algol-60. It was elegant, surprising,
and, at the time of introduction, horribly inefficient.
|For this reason, it was not adapted in later programming
languages. Instead, procedure types or explicit anonymous
procedures were used.
|Call by name treats the actual parameter as an implicit
anonymous procedure with no parameters but with a lexical
closure. It is passed in form of a so-called thunk
(a reference to the anonymous procedure) and evaluated only
if necessary. However, it is not the normal form of
lazy evaluation as the parameter is newly evaluated on each access.
|If just a variable is passed, call-by-name is equivalent
to call-by-reference. In case of actual parameters that
are constant expressions, call-by-name is equivalent to
|Copyright © 2002 Andreas Borchert, converted to HTML on May 02, 2002|