GNU bug report logs - #11988
eval-case redefinition?

Previous Next

Package: guile;

Reported by: Daniel Llorens <daniel.llorens <at> bluewin.ch>

Date: Thu, 19 Jul 2012 13:30:01 UTC

Severity: normal

Done: Mark H Weaver <mhw <at> netris.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: ludo <at> gnu.org (Ludovic Courtès)
To: Daniel Llorens <daniel.llorens <at> bluewin.ch>
Cc: 11988 <at> debbugs.gnu.org
Subject: bug#11988: eval-case redefinition?
Date: Sat, 06 Oct 2012 23:24:19 +0200
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.