This is the mail archive of the
guile@sourceware.cygnus.com
mailing list for the Guile project.
Re: Bad define placement?
"<Brad Knotwell" <knotwell@f5.com> writes:
> Along the same lines, code like this contrived example worked in
> guile1.3 but doesn't work now:
>
> (define (test-fun x)
> (define tt? (eq? x 3))
> (define return-val
> (if tt? #t #f))
> return-val)
[...]
> Is this a bug related to the currently discussed one, a brand new
> bug or an incorrect method that took advantage of a previous bug in
> guile?
Well, let's see... we'll first rewrite it accroding to R5RS:
(define (test-fun x)
(letrec ((tt? (eq? x 3))
(return-val (if tt? #t #f)))
return-val))
The bindings introduced by a `letrec' as a scope which includes the
definitions, but since all bindings are bound "in parallell", it is
not allowed to *use* any of the introduced bindings during the
definition.
So, the access of `tt?' in the `if' is a bug, and, yes, it was
undetected previously.