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

Re: [Scheme-reports] Some comments after reading the r7rs public draft

Yesterday, Aaron W. Hsu wrote:
> Thus, instead, I would prefer to clarify that a forced thunk should
> evaluate in a context equivalent to the dynamic context (including
> exception handlers and parameters) of the call to force which first
> requested the delayed expression's value.

That would be good, but most implementations don't do that:

  Petite Chez Scheme Version 8.4
  Copyright (c) 1985-2011 Cadence Research Systems
  > (define foo (let ([c 0]) (delay (begin (set! c (+ c 1)) (/ 1 (- c 1))))))
  > (force foo)
  Exception in /: undefined for 0
  > (force foo)

(Racket does the right thing, but it has an obvious overhead.)

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

Scheme-reports mailing list