unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
From: Nala Ginrut <nalaginrut@gmail.com>
To: 18245@debbugs.gnu.org
Subject: bug#18245: [master branch] Useless imported module cause strange problem
Date: Mon, 11 Aug 2014 17:14:48 +0800	[thread overview]
Message-ID: <1407748488.5167.7.camel@Renee-desktop.suse> (raw)

[-- Attachment #1: Type: text/plain, Size: 636 bytes --]

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)




[-- Attachment #2: mmr.scm --]
[-- Type: text/x-scheme, Size: 1274 bytes --]

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

[-- Attachment #3: mmr2.scm --]
[-- Type: text/x-scheme, Size: 157 bytes --]

(define-module (xxx mmr2)
  #:use-module (xxx mmr)
  #:use-module (srfi srfi-1)
  #:export (mmr))

(define mmr (->sql2 alter table 'tname drop primary key))

             reply	other threads:[~2014-08-11  9:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-11  9:14 Nala Ginrut [this message]
2014-08-11 15:30 ` bug#18245: [master branch] Useless imported module cause strange problem Mark H Weaver
2014-08-12  1:46   ` Nala Ginrut

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=1407748488.5167.7.camel@Renee-desktop.suse \
    --to=nalaginrut@gmail.com \
    --cc=18245@debbugs.gnu.org \
    /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).