From unknown Fri Jun 20 07:19:46 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#18245 <18245@debbugs.gnu.org> To: bug#18245 <18245@debbugs.gnu.org> Subject: Status: [master branch] Useless imported module cause strange problem Reply-To: bug#18245 <18245@debbugs.gnu.org> Date: Fri, 20 Jun 2025 14:19:46 +0000 retitle 18245 [master branch] Useless imported module cause strange problem reassign 18245 guile submitter 18245 Nala Ginrut severity 18245 normal tag 18245 notabug thanks From debbugs-submit-bounces@debbugs.gnu.org Mon Aug 11 05:15:33 2014 Received: (at submit) by debbugs.gnu.org; 11 Aug 2014 09:15:33 +0000 Received: from localhost ([127.0.0.1]:38554 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XGlhS-0003mo-UQ for submit@debbugs.gnu.org; Mon, 11 Aug 2014 05:15:32 -0400 Received: from eggs.gnu.org ([208.118.235.92]:52317) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XGlhP-0003mX-Ow for submit@debbugs.gnu.org; Mon, 11 Aug 2014 05:15:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XGlhB-00071z-FF for submit@debbugs.gnu.org; Mon, 11 Aug 2014 05:15:22 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-0.5 required=5.0 tests=BAYES_05,FREEMAIL_FROM, T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:43589) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XGlhB-00071v-Br for submit@debbugs.gnu.org; Mon, 11 Aug 2014 05:15:13 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53984) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XGlh2-0000ma-8T for bug-guile@gnu.org; Mon, 11 Aug 2014 05:15:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XGlgt-0006hp-7b for bug-guile@gnu.org; Mon, 11 Aug 2014 05:15:04 -0400 Received: from mail-pa0-x234.google.com ([2607:f8b0:400e:c03::234]:58089) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XGlgt-0006hl-02 for bug-guile@gnu.org; Mon, 11 Aug 2014 05:14:55 -0400 Received: by mail-pa0-f52.google.com with SMTP id bj1so10778732pad.39 for ; Mon, 11 Aug 2014 02:14:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:subject:from:to:date:organization:content-type :mime-version; bh=bzymqlvtIkCUTybiLCHYgk5M3wIWu4B0UfJphJFypDo=; b=ib0Z0UbEEG16jQdZ+ilJQJSFgQZXM1+XyGPVlKsA+OxahrLXRnZK6oEAlB9gXpOOH8 dhr8FzR/4DsZx0xEkA0WmoXLzw4roNJfCHm2/hga1tAyvLznHn64CNxKQQnkKSzar2OO Uhsf5+vyglNG+N9GbSYPRXzuqUDshcZSoTWnSk8vua0vR1Rbj14QUVF6+at3o05dtHVO VZThkAaN/tDjSd7yntg2+Wo2abfP4K9tPW2RS0wFSqzjLGd/o7Bp6UzkGN0zcPMtDcdV qWkGQ0NTmx1mdbK6AQOZS0cS6/wQ6TB7Kyz/PeyjHEi91wqB7r8kfvBlLc0AazA29HPX PZ+w== X-Received: by 10.68.244.40 with SMTP id xd8mr41009797pbc.24.1407748493577; Mon, 11 Aug 2014 02:14:53 -0700 (PDT) Received: from [147.2.147.182] ([203.192.156.9]) by mx.google.com with ESMTPSA id t7sm16524114pdj.94.2014.08.11.02.14.50 for (version=SSLv3 cipher=RC4-SHA bits=128/128); Mon, 11 Aug 2014 02:14:52 -0700 (PDT) Message-ID: <1407748488.5167.7.camel@Renee-desktop.suse> Subject: [master branch] Useless imported module cause strange problem From: Nala Ginrut To: bug-guile@gnu.org Date: Mon, 11 Aug 2014 17:14:48 +0800 Organization: HFG Content-Type: multipart/mixed; boundary="=-pZ474uMQOVMzmEKykDB8" X-Mailer: Evolution 3.4.4 Mime-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) --=-pZ474uMQOVMzmEKykDB8 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit 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) --=-pZ474uMQOVMzmEKykDB8 Content-Disposition: attachment; filename="mmr.scm" Content-Type: text/x-scheme; name="mmr.scm"; charset="UTF-8" Content-Transfer-Encoding: 7bit (define-module (xxx mmr) #:export (->sql2)) (define-syntax -> (syntax-rules (end) ((_ end fmt args ...) (format #f "~@?;" fmt args ...)) ((_ fmt args ...) (format #f fmt args ...)))) (define-syntax-rule (->end name arg) (-> end "~a ~a" name arg)) (define-syntax sql-alter (syntax-rules (table rename to add modify drop column as select primary key) ((_ table name drop primary key) (-> "table ~a drop primary key" name)) ((_ table old-name rename to new-name) (-> "table ~a rename to ~a" old-name new-name)) ((_ table name add cname ctype) ;; e.g: (->sql alter table 'mmr add 'cname 'varchar(50)) (-> "table ~a add ~a ~a" cname ctype)) ((_ table name mofify pairs) (-> "table ~a modify (~{~a~^,~})" name (->lst pairs))) ((_ table name drop column cname) (-> "table ~a drop column ~a" name cname)) ((_ table name add primary key keys) (-> "table ~a add primary key (~{~a~^,~})" name keys)) ((_ table name rename column old-name to new-name) (-> "table ~a rename column ~a to ~a" name old-name new-name)))) (define-syntax ->sql2 (syntax-rules (select insert alter create update delete use) ((_ alter rest ...) (->end 'alter (sql-alter rest ...))))) --=-pZ474uMQOVMzmEKykDB8 Content-Disposition: attachment; filename="mmr2.scm" Content-Type: text/x-scheme; name="mmr2.scm"; charset="UTF-8" Content-Transfer-Encoding: 7bit (define-module (xxx mmr2) #:use-module (xxx mmr) #:use-module (srfi srfi-1) #:export (mmr)) (define mmr (->sql2 alter table 'tname drop primary key)) --=-pZ474uMQOVMzmEKykDB8-- From debbugs-submit-bounces@debbugs.gnu.org Mon Aug 11 11:31:47 2014 Received: (at 18245) by debbugs.gnu.org; 11 Aug 2014 15:31:47 +0000 Received: from localhost ([127.0.0.1]:39487 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XGrZW-0006Bk-Vw for submit@debbugs.gnu.org; Mon, 11 Aug 2014 11:31:47 -0400 Received: from world.peace.net ([96.39.62.75]:41425 ident=hope2) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XGrZL-0006BL-NS; Mon, 11 Aug 2014 11:31:36 -0400 Received: from c-24-62-95-23.hsd1.ma.comcast.net ([24.62.95.23] helo=yeeloong.lan) by world.peace.net with esmtpsa (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1XGrZB-0003RX-EZ; Mon, 11 Aug 2014 11:31:21 -0400 From: Mark H Weaver To: Nala Ginrut Subject: Re: bug#18245: [master branch] Useless imported module cause strange problem References: <1407748488.5167.7.camel@Renee-desktop.suse> Date: Mon, 11 Aug 2014 11:30:32 -0400 In-Reply-To: <1407748488.5167.7.camel@Renee-desktop.suse> (Nala Ginrut's message of "Mon, 11 Aug 2014 17:14:48 +0800") Message-ID: <874mxjqc13.fsf@yeeloong.lan> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 18245 Cc: 18245@debbugs.gnu.org, request@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) tags 18245 notabug close 18245 thanks Nala Ginrut 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 From debbugs-submit-bounces@debbugs.gnu.org Mon Aug 11 21:46:57 2014 Received: (at 18245) by debbugs.gnu.org; 12 Aug 2014 01:46:57 +0000 Received: from localhost ([127.0.0.1]:39799 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XH1Au-00062h-Q6 for submit@debbugs.gnu.org; Mon, 11 Aug 2014 21:46:57 -0400 Received: from mail-la0-f49.google.com ([209.85.215.49]:38348) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XH1As-00062M-6H; Mon, 11 Aug 2014 21:46:55 -0400 Received: by mail-la0-f49.google.com with SMTP id hz20so7184083lab.8 for ; Mon, 11 Aug 2014 18:46:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=VbvrBRYlCosRw2uQRfANch0GuU7Nrjh6+cAhfwotc2I=; b=EzSiU+QZMCMv5oqy3Uaq055gG3UYSyIusKdWgyH+mpMrGEDnvbS0y9U+ih0MGKIWiB V4Llg1ZifFFavbWsPvFWtOk/cTQLqbQ4sHzZXawZ+lFAunCNmETtePb3p92x4PTRqy0E NACba9btyaDJ76Dv4Dt370vv2p1lNGBuTwZM94HoVhxcpofrHDUJizYcnjEYWBfU+seZ hpMNYBdUmh4+mKlUmVVk5TobUZsGi0b6EJfWFPfbZtBCFHLwXf/Ozi4znRnzjXfYKY5y w6prRXcw+8SjGW0KnO1NenMmKh5E7FB8G6Lf4+RmlAaM/UKVz3M3Hkx9XZB7ca/I/Ehh qEsA== MIME-Version: 1.0 X-Received: by 10.112.24.167 with SMTP id v7mr1086733lbf.19.1407808007571; Mon, 11 Aug 2014 18:46:47 -0700 (PDT) Received: by 10.152.122.99 with HTTP; Mon, 11 Aug 2014 18:46:47 -0700 (PDT) Received: by 10.152.122.99 with HTTP; Mon, 11 Aug 2014 18:46:47 -0700 (PDT) In-Reply-To: <874mxjqc13.fsf@yeeloong.lan> References: <1407748488.5167.7.camel@Renee-desktop.suse> <874mxjqc13.fsf@yeeloong.lan> Date: Tue, 12 Aug 2014 09:46:47 +0800 Message-ID: Subject: Re: bug#18245: [master branch] Useless imported module cause strange problem From: Nala Ginrut To: Mark H Weaver Content-Type: multipart/alternative; boundary=001a1134997a341020050064d8e9 X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 18245 Cc: 18245@debbugs.gnu.org, request@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) --001a1134997a341020050064d8e9 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 2014=E5=B9=B48=E6=9C=8811=E6=97=A5 =E4=B8=8B=E5=8D=8811:31=E4=BA=8E "Mark H= Weaver" =E5=86=99=E9=81=93=EF=BC=9A > > 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! --001a1134997a341020050064d8e9 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable


2014=E5=B9=B48=E6=9C=8811=E6=97=A5 =E4=B8=8B=E5=8D=8811:31=E4=BA=8E "M= ark H Weaver" <mhw@netris.org= >=E5=86=99=E9=81=93=EF=BC=9A
>
> tags 18245 notabug
> close 18245
> thanks
>

> The problem is that srfi-1 exports a 'drop' pro= cedure, and 'drop' is
> also used as a syntax-rules literal in your macros. =C2=A0Literals are=
> matched as follows: if the literal identifier has the same name and th= e
> same binding where the macro is defined and where it is used, then
> there's a match. =C2=A0If the identifier is not bound in either pl= ace, 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 modul= es
> that use your sql macros.
>

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

Thanks!

--001a1134997a341020050064d8e9-- From unknown Fri Jun 20 07:19:46 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Tue, 09 Sep 2014 11:24:05 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator