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

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Mon Jan 28 08:31:09 EST 2008

On Jan 28, 2008, at 1:28 AM, Benjamin L. Russell wrote:

> 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?

(1) You don't mean call-by-name. You want call-by-need, which is lazy.

(2) A lot. A HUGE amount of work went into strictness analyses in the  
80s and 90s, meaning work on lazy languages to figure out when they  
don't have to build a thunk. (The word goes back to Algol60, and  
there it refers to call-by-NAME.) With a plain-old THUNK macro, you  
don't get this.

(3) Conjecture: You could probably use the module system in PLT  
Scheme to build a locally optimizing lazy Scheme, which would get you  
there 80% of the way.

> 2) Recently, there seems to have been a great increase
> in focus on lazy evaluation across the functional
> programming landscape.

What evidence do you have for that? I actually believe that interest  
in laziness peaked in the late 90s and has dwindled to little.

> How well, and in what manner,
> does Scheme, as a language with strict evaluation,
> cope with this trend?

See Eli's Lazy Scheme. -- Matthias

Posted on the users mailing list.