GNU bug report logs -
#11988
eval-case redefinition?
Previous Next
Full log
View this message in rfc822 format
Hi,
Sorry for the delay.
Daniel Llorens <daniel.llorens <at> bluewin.ch> skribis:
> I was cleaning up an old script which goes like this:
>
> (define (eval-case ...) ... val)
>
> (define var (eval-case ...))
>
> This worked from the REPL, but when loading the file with (load
> "script"), var was always #<unspecified>. It turns out that (my)
> eval-case is never executed in this case.
It turns out that ‘eval-case’ is a macro, and it gets macro-expanded in
the RHS of ‘define var’ above.
This is the same situation as:
--8<---------------cut here---------------start------------->8---
(define-syntax-rule (foo x) (- x))
(define (foo x) x)
(pk 'foo (foo 42)) ; prints -42
--8<---------------cut here---------------end--------------->8---
“Expansion process” in R6RS seems to suggest that this is a bug:
For the right-hand side of the definition of a variable, ex-
pansion is deferred until after all of the definitions have
been seen. Consequently, each keyword and variable refer-
ence within the right-hand side resolves to the local bind-
ing, if any.
Hmmm... Thoughts?
Ludo’.
This bug report was last modified 11 years and 125 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.