GNU bug report logs - #18245
[master branch] Useless imported module cause strange problem

Previous Next

Package: guile;

Reported by: Nala Ginrut <nalaginrut <at> gmail.com>

Date: Mon, 11 Aug 2014 09:16:02 UTC

Severity: normal

Tags: notabug

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 18245 in the body.
You can then email your comments to 18245 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#18245; Package guile. (Mon, 11 Aug 2014 09:16:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Nala Ginrut <nalaginrut <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-guile <at> gnu.org. (Mon, 11 Aug 2014 09:16:02 GMT) Full text and rfc822 format available.

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

From: Nala Ginrut <nalaginrut <at> gmail.com>
To: bug-guile <at> gnu.org
Subject: [master branch] Useless imported module cause strange problem
Date: Mon, 11 Aug 2014 17:14:48 +0800
[Message part 1 (text/plain, inline)]
Note this bug is under Master branch, it's fine in stable-2.0.


I've imported srfi-1, but after some modifications, the program happens
not to use any srfi-1 symbols, then there's the problem that one of the
rule in syntax-rules can't be found and threw error.
It works when I removed useless srfi-1 from imported list.


I think srfi-1 here is not related, and maybe the same with
syntax-rules. But I can reproduce it with these two prerequisites.


I've attached two simplified files(modules) for reproducing.
(The code may look not so nice, but it's unrelated, some code looks ugly
because of the simplification from my project)



[mmr.scm (text/x-scheme, attachment)]
[mmr2.scm (text/x-scheme, attachment)]

Information forwarded to bug-guile <at> gnu.org:
bug#18245; Package guile. (Mon, 11 Aug 2014 15:32:01 GMT) Full text and rfc822 format available.

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

From: Mark H Weaver <mhw <at> netris.org>
To: Nala Ginrut <nalaginrut <at> gmail.com>
Cc: 18245 <at> debbugs.gnu.org, request <at> debbugs.gnu.org
Subject: Re: bug#18245: [master branch] Useless imported module cause strange
 problem
Date: Mon, 11 Aug 2014 11:30:32 -0400
tags 18245 notabug
close 18245
thanks

Nala Ginrut <nalaginrut <at> gmail.com> writes:
> I've imported srfi-1, but after some modifications, the program happens
> not to use any srfi-1 symbols, then there's the problem that one of the
> rule in syntax-rules can't be found and threw error.
> It works when I removed useless srfi-1 from imported list.

The problem is that srfi-1 exports a 'drop' procedure, and 'drop' is
also used as a syntax-rules literal in your macros.  Literals are
matched as follows: if the literal identifier has the same name and the
same binding where the macro is defined and where it is used, then
there's a match.  If the identifier is not bound in either place, then
there's also a match.

However, in this case 'drop' is not defined where the 'sql-alter' macro
is defined, but it _is_ defined to a procedure in srfi-1 in your example
module where it is used.  Therefore, the macro does not consider the
'drop' to be a match for the literal it's looking for.

This is similar to the issue that if you define 'else' to be something
in a module (or import it from somewhere), then 'else' will no longer
have its special meaning in a 'cond' form.  Ditto for '=>'.

There is some question about whether these rules for matches literals
are the best ones, and the issue has been debated during the R7RS
standardization process, but nonetheless the standards are clear on this
matter.

I recommend choosing literals that are not likely to be bound in modules
that use your sql macros.

I'm closing this.

     Regards,
       Mark




Added tag(s) notabug. Request was from Mark H Weaver <mhw <at> netris.org> to control <at> debbugs.gnu.org. (Mon, 11 Aug 2014 15:32:02 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 18245 <at> debbugs.gnu.org and Nala Ginrut <nalaginrut <at> gmail.com> Request was from Mark H Weaver <mhw <at> netris.org> to control <at> debbugs.gnu.org. (Mon, 11 Aug 2014 15:32:03 GMT) Full text and rfc822 format available.

Information forwarded to bug-guile <at> gnu.org:
bug#18245; Package guile. (Tue, 12 Aug 2014 01:47:02 GMT) Full text and rfc822 format available.

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

From: Nala Ginrut <nalaginrut <at> gmail.com>
To: Mark H Weaver <mhw <at> netris.org>
Cc: 18245 <at> debbugs.gnu.org, request <at> debbugs.gnu.org
Subject: Re: bug#18245: [master branch] Useless imported module cause strange
 problem
Date: Tue, 12 Aug 2014 09:46:47 +0800
[Message part 1 (text/plain, inline)]
2014年8月11日 下午11:31于 "Mark H Weaver" <mhw <at> netris.org>写道:
>
> tags 18245 notabug
> close 18245
> thanks
>

> The problem is that srfi-1 exports a 'drop' procedure, and 'drop' is
> also used as a syntax-rules literal in your macros.  Literals are
> matched as follows: if the literal identifier has the same name and the
> same binding where the macro is defined and where it is used, then
> there's a match.  If the identifier is not bound in either place, then
> there's also a match.
>

Thanks for explaining!
The issue can't be reproduced in stable-2.0, so I suspected it's a
potential bug.

>
> I recommend choosing literals that are not likely to be bound in modules
> that use your sql macros.
>

Or import srfi-1 with a proper prefix :-)

Thanks!
[Message part 2 (text/html, inline)]

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

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

Previous Next


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