[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: strict promises?

This page is part of the web mail archives of SRFI 45 from before July 7th, 2015. The new archives for SRFI 45 contain all messages, not just those from before July 7th, 2015.



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.