unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
* bug#18245: [master branch] Useless imported module cause strange problem
@ 2014-08-11  9:14 Nala Ginrut
  2014-08-11 15:30 ` Mark H Weaver
  0 siblings, 1 reply; 3+ messages in thread
From: Nala Ginrut @ 2014-08-11  9:14 UTC (permalink / raw)
  To: 18245

[-- 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))

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-08-12  1:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-11  9:14 bug#18245: [master branch] Useless imported module cause strange problem Nala Ginrut
2014-08-11 15:30 ` Mark H Weaver
2014-08-12  1:46   ` Nala Ginrut

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