[racket] lazy letrec-values

From: Eli Barzilay (eli at barzilay.org)
Date: Sun Jul 13 04:24:06 EDT 2014

On Thu, Jul 10, 2014 at 1:24 PM, Matthew Flatt <mflatt at cs.utah.edu> wrote:
> I'm not sure whether to call it a bug or a limitation of `lazy`.

There is a "borderline bug" and a "borderline premature optimization".
The bug is the way that multiple values are represented (and I'll write
more in a different post).


> The `lazy` language doesn't delay a reference to an identifier. As a
> result,
>
>  (define x y)
>  (define y (list 1))
>  (car x)
>
> fails. The case could be made that the right-hand side of the definition
> of `x` should have been a lazy reference to `y`, but that's not what
> `lazy` currently does.

This is the optimization issue -- that's the reason that I orignally
made it avoid delaying identifiers and literals.  But it's not really
premature in the sense that adding these kinds of delays makes things
significantly slower.  It might be that jit improvements would make it
better, but my guess is that there's enough "noise code" in delays that
will still make it too slow to be practical.  (That's a vague argument
for having laziness in the core code...)

-- 
          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                    http://barzilay.org/                   Maze is Life!

Posted on the users mailing list.