Re: [Scheme-reports] Some comments after reading the r7rs public draft
Alex Shinn 08 Jun 2012 23:32 UTC
On Fri, Jun 8, 2012 at 6:33 PM, Eli Barzilay <eli@barzilay.org> wrote:
> 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)
> 1
>
> (Racket does the right thing, but it has an obvious overhead.)
That's an interesting example, but I'm not entirely
sure what the right thing is. Is it to store and re-raise
the same exception object?
It seems reasonable to provide looser force/delay
semantics when force raises an exception.
--
Alex
_______________________________________________
Scheme-reports mailing list
Scheme-reports@scheme-reports.org
http://lists.scheme-reports.org/cgi-bin/mailman/listinfo/scheme-reports