This is the mail archive of the
guile@cygnus.com
mailing list for the Guile project.
Re: corrupt environment?
- To: guile@cygnus.com
- Subject: Re: corrupt environment?
- From: Radey Shouman <Radey_Shouman@splashtech.com>
- Date: 16 Jun 1999 13:26:38 -0400
- Cc: radey@colorage.com
roland.kaufmann@space.at writes:
> >>>>> "Radey" == Radey Shouman <Radey_Shouman@splashtech.com> writes:
[ ... ]
> (letrec ((foo (lambda (arg)
> (or arg (and (procedure? foo)
> (foo 99))))))
> (define bar (foo #f))
> (foo #f))
> ==> 99
>
> (letrec ((foo 77)
> (bar #f)
> (retfoo (lambda () foo)))
> (define baz (retfoo))
> (retfoo))
> ==> 77
> Both Guile 1.2 and a recent (June 11, 1999) CVS version yield #f for
> both forms.
Thanks for checking. This behavior is clearly a bug, as can be seen
by converting the above forms to LETRECs.
For example:
(letrec ((foo (lambda (arg)
(or arg (and (procedure? foo)
(foo 99))))))
(define bar (foo #f))
(foo #f))
Becomes:
(letrec ((foo (lambda (arg)
(or arg (and (procedure? foo)
(foo 99))))))
(letrec ((bar (foo #f)))
(foo #f)))
Guile essentially converts the original expression to:
(letrec ((foo (lambda (arg)
(or arg (and (procedure? foo)
(foo 99)))))
(bar (foo #f)))
(foo #f))
Which is plainly not quite right.
I don't know what plans are laid for the future Guile macro-expander
and evaluator. If it is to remain SCM-like for some time then the
approach used in the current SCM could be retro-fitted.
I would love to see a macro system in which internal DEFINE could be
written in a natural way.