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.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 11988 in the body.
You can then email your comments to 11988 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-guile <at> gnu.org:
bug#11988; Package guile. (Thu, 19 Jul 2012 13:30:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Daniel Llorens <daniel.llorens <at> bluewin.ch>:
New bug report received and forwarded. Copy sent to bug-guile <at> gnu.org. (Thu, 19 Jul 2012 13:30:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Daniel Llorens <daniel.llorens <at> bluewin.ch>
To: bug-guile <at> gnu.org
Subject: eval-case redefinition?
Date: Thu, 19 Jul 2012 15:22:44 +0200
This looks like a bug (v2.0.6).

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.

So I look around to find that eval-case is something that has been replaced by eval-when and is now deprecated.

But no matter what eval-case is, it is bad that the redefinition is being ignored silently.

Regards,

	Daniel





Information forwarded to bug-guile <at> gnu.org:
bug#11988; Package guile. (Sat, 06 Oct 2012 21:25:01 GMT) Full text and rfc822 format available.

Message #8 received at 11988 <at> debbugs.gnu.org (full text, mbox):

From: ludo <at> gnu.org (Ludovic Courtès)
To: Daniel Llorens <daniel.llorens <at> bluewin.ch>
Cc: 11988 <at> debbugs.gnu.org
Subject: Re: 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’.




Information forwarded to bug-guile <at> gnu.org:
bug#11988; Package guile. (Tue, 05 Mar 2013 18:55:02 GMT) Full text and rfc822 format available.

Message #11 received at 11988 <at> debbugs.gnu.org (full text, mbox):

From: Andy Wingo <wingo <at> pobox.com>
To: Daniel Llorens <daniel.llorens <at> bluewin.ch>
Cc: 11988 <at> debbugs.gnu.org, ludo <at> gnu.org, Ian Price <ianprice90 <at> googlemail.com>
Subject: Re: bug#11988: eval-case redefinition?
Date: Tue, 05 Mar 2013 17:15:18 +0100
On Thu 19 Jul 2012 15:22, Daniel Llorens <daniel.llorens <at> bluewin.ch> writes:

> 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.

I wonder if this is related to bug 13865.

I tried a script with these contents:

  (define (eval-case val)
    val)

  (define var (eval-case 2))

And I can reproduce the bug with stable-2.0.  `master' seems to have the
right behavior however.  If I had to guess I would think that this was
fixed by the following commit on `master':

    commit 19ef14f9b8b73c04acbbfa6bd993908171bc69f7
    Author: Andy Wingo <wingo <at> pobox.com>
    Date:   Fri Nov 4 19:37:04 2011 +0100

    defined identifiers scoped in the current module
    
    * ice-9/psyntax.scm (chi-top-sequence): Wrap defined identifiers with
      the current module.  Fixes http://savannah.gnu.org/bugs/?31472.

Or one of the commits around it that has to do with toplevel bindings.
Tough to tell, as that code is significantly different in master as
compared to stable-2.0.

Andy
-- 
http://wingolog.org/




Reply sent to Mark H Weaver <mhw <at> netris.org>:
You have taken responsibility. (Tue, 21 Jan 2014 05:30:03 GMT) Full text and rfc822 format available.

Notification sent to Daniel Llorens <daniel.llorens <at> bluewin.ch>:
bug acknowledged by developer. (Tue, 21 Jan 2014 05:30:03 GMT) Full text and rfc822 format available.

Message #16 received at 11988-done <at> debbugs.gnu.org (full text, mbox):

From: Mark H Weaver <mhw <at> netris.org>
To: ludo <at> gnu.org (Ludovic Courtès)
Cc: 11988-done <at> debbugs.gnu.org, Daniel Llorens <daniel.llorens <at> bluewin.ch>
Subject: Re: bug#11988: eval-case redefinition?
Date: Tue, 21 Jan 2014 00:26:54 -0500
ludo <at> gnu.org (Ludovic Courtès) writes:

> 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 bug is now fixed on the stable-2.0 branch.

  http://git.savannah.gnu.org/gitweb/?p=guile.git;a=commitdiff;h=8de355d08e25a877326489c4b0eb09d313c548dc

I'm closing the bug now.  Feel free to reopen if you think there's still
a problem.

    Thanks!
      Mark




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 18 Feb 2014 12:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 10 years and 67 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.