[plt-scheme] about letrec and continuation : which behavior is correct ? and why ?
On Tue, Aug 19, 2008 at 7:44 AM, Abdulaziz Ghuloum
<aghuloum at cs.indiana.edu> wrote:
>
> On Aug 19, 2008, at 7:10 AM, Matthew Flatt wrote:
>
>> The R5RS/R6RS `letrec' is different, and the result with that other
>> `letrec' should be #f:
I've always thought this was a wart in the language.
>
> An R6RS implementation may (or may not) raise an &assertion when the
> <init> continuation is invoked the second time, right?
Ugh. That's worse than the SET! expansion.
It seems to me that Matthias's derivation is the `right way' and how
it `should be done'.
The SET! expansion seems way too New Jersey, and just
legislating that `legal programs' aren't allowed to check is
heinous.
(define (foo)
(if (zero? (modulo (real-time-clock) 2))
(call/cc list)
#t))
(letrec ((x (foo)))
....)
Now I have a program that's `legal' half the time.
--
~jrm