[R6RS] Yet another question (to Matthew I guess)
Manuel Serrano
Manuel.Serrano
Mon Oct 4 11:53:02 EDT 2004
> (define export-gee) ; actually a generated module export name
> (let ([valid? #f])
> (letrec ([foo (lambda ()
> (let loop ([n 1000000000000000000000000000000000000000000000])
> (if (> n 0)
> (begin
> (bar n)
> (loop (- n 1))))))]
> [bar (lambda (n) <whatever you want>)]
> [gee (lambda () ...(foo)...)])
> (if (read)
> ((begin
> (if (not valid?) (undefined-variable-error 'foo))
> foo)))
> (set! valid? #t)
> (set! export-gee gee)))
The problem is not with FOO. The problem is with BAR. How can you be sure
in FOO that BAR has been properly initialized. With respect to the semantics
(or what I understand of it) of MzScheme, this program should raise an
error, as the program:
(module foo r6rs
(provides gee)
(define (foo)
(let loop ((n 1000000000000000000000000000000000000000000000))
(if (> n 0)
(begin
(bar n)
(loop (- n 1))))))
(if (read)
(foo))
(define (bar n)
<whatever you want>)
(define (gee)
...(foo)...))
--
Manuel
More information about the R6RS
mailing list