Re: strict promises? Andre van Tonder 08 Feb 2004 19:37 UTC

On Sun, 8 Feb 2004, Andre van Tonder wrote:

> 3) Make it an optimization issue:  In other words, keep the interface
>    as it is now {lazy, delay, force}  but special-case the *delay* macro
>    such that
>      (delay e)       = (cons 'value e) when e atomic (literal or variable)
>      (delay (quote e)) = (cons 'value (quote e))
>    This would make the above examples efficient, and would make *strict*
>    definable as (strict e) = (let ((x e)) (delay x)) if
>    someone should need it for arbitrary expressions.

I just realized that this won't work.  We cannot optimize (delay e), for e
a variable, when the variable may be mutated by set!. So
*strict* would either have to be a primitive or slightly less efficient if
defined as above in terms of *delay*.

I'm having difficulty, though, in thinking of any practical examples where
this might make a significant difference in execution speed.  I am
therefore still struggling with a rationale for either including it or
not.