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


I have finally switched the Lazy Scheme implementation in PLT to the
implementation that was described here.  (Close: it deals with
multiple values only in `delay'.)

There is, however, a problem with marking a currently-evaluated
promise.  The straightforward implementation does this:

  > (define e (delay (+ 1 "2")))
  > (force e)
  +: expects type <number> as 2nd argument, given: "2"; other arguments were: 1
  > (force e)
  force: reentrant promise

The same problem exists in existing delay/force implementations
(practically every one that I tried):

  > (define e (delay (list-ref '(1 2 3) (random 6))))
  > (force e)
  > (force a)

A solution to this is straightforward (given some way to capture and
store exceptions), but in many cases (as in mzscheme), catching errors
has some run-time cost.

This is a problem for implementing a lazy language.  Because of this,
I'm considering alternatives, like not marking the current node and
not doing the update-on-every-step thing.  Andre, perhaps you'll think
of a better solution?

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