[plt-scheme] call-by-value vs. call-by-name?

From: Benjamin L. Russell (dekudekuplex at yahoo.com)
Date: Mon Jan 28 01:28:01 EST 2008

Recently, I read in a paper ("A History of Haskell:
Being Lazy With Class"
[http://research.microsoft.com/~simonpj/papers/history-of-haskell/history.pdf])
that Gerry Sussman and Guy Steele originally weighed
call-by-value (a form of strict evaluation) and
call-by-name (a form of lazy evaluation) for Scheme,
and decided on the former; viz (page 3, first column):

"'An interesting sidelight is that the Friedman and
Wise paper ["Cons should not evaluate its arguments"
(http://www.cs.indiana.edu/pub/techreports/TR44.pdf)]
inspired Sussman and Steele to examine lazy evaluation
in Scheme, and for a time they weighed whether to make
the revised version of Scheme call-by-name or
call-by-value. They eventually chose to retain the
original call-by-value design, reasoning that it
seemed to be much easier to simulate call-by-name in a
call-by-value language (using lambda-expressions as
thunks), than to simulate call-by-value in a
call-by-name language (which requires a separate
evaluation-forcing mechanism).'"

According to the Wikipedia definition of "thunk"
(http://en.wikipedia.org/wiki/Thunk), in Scheme, this
refers to a nullary function, often used in a strict
language to simulate call-by-name evaluation,
performing a delayed computation of the function's
argument, and is often called a "promise."

However, I am not sure about how much difference there
is in efficiency between using a thunk to simulate
lazy evalution in Scheme, and using a language with
built-in lazy evaluation (say, either Haskell or
Concurrent Clean) to compute a function in which an
argument may potentially be undefined.

This brings to mind two questions:

1) How much difference is there in efficiency between
simulating call-by-name in Scheme using thunks, and
using a language with built-in call-by-name semantics?

2) Recently, there seems to have been a great increase
in focus on lazy evaluation across the functional
programming landscape.  How well, and in what manner,
does Scheme, as a language with strict evaluation,
cope with this trend?

Benjamin L. Russell


Posted on the users mailing list.