unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
From: ludo@gnu.org (Ludovic Courtès)
To: Daniel Llorens <daniel.llorens@bluewin.ch>
Cc: 11988@debbugs.gnu.org
Subject: bug#11988: eval-case redefinition?
Date: Sat, 06 Oct 2012 23:24:19 +0200	[thread overview]
Message-ID: <87r4pb5m64.fsf@gnu.org> (raw)
In-Reply-To: <BCD26E80-CD4C-4B17-8D74-0722BFB395B5@bluewin.ch> (Daniel Llorens's message of "Thu, 19 Jul 2012 15:22:44 +0200")

Hi,

Sorry for the delay.

Daniel Llorens <daniel.llorens@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’.





  reply	other threads:[~2012-10-06 21:24 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-19 13:22 bug#11988: eval-case redefinition? Daniel Llorens
2012-10-06 21:24 ` Ludovic Courtès [this message]
2014-01-21  5:26   ` Mark H Weaver
2013-03-05 16:15 ` Andy Wingo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87r4pb5m64.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=11988@debbugs.gnu.org \
    --cc=daniel.llorens@bluewin.ch \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).