unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
* [bug #20941] Modules interact badly with macros
@ 2007-08-31 12:41 Andreas Rottmann
  2007-10-31  0:23 ` Neil Jerram
  0 siblings, 1 reply; 4+ messages in thread
From: Andreas Rottmann @ 2007-08-31 12:41 UTC (permalink / raw)
  To: Andreas Rottmann, bug-guile


URL:
  <http://savannah.gnu.org/bugs/?20941>

                 Summary: Modules interact badly with macros
                 Project: Guile
            Submitted by: rottmann
            Submitted on: Friday 08/31/2007 at 14:41
                Category: None
                Severity: 3 - Normal
              Item Group: None
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any

    _______________________________________________________

Details:

When a (syntax-rules) macro expands into the use of an internal procedure,
the module the macro resides in must export that internal procedure, which
should not be necessary.

Example session:

guile> (version)
"1.8.2"
guile> (define-module (test) #:export (test-macro) #:use-module (ice-9
syncase)
#<directory (test) b7b2a1d0>
guile> (define (test-proc x) (write x) (newline))
guile> (define-syntax test-macro (syntax-rules () ((test-macro x) (test-proc
(* x x)))))
guile> (define-module (test-user) #:use-module (test))
#<directory (test-user) b7b28ae0>
guile> test-macro
#<macro! sc-macro>
guile> (test-macro 5)

Backtrace:
In standard input:
   9: 0* (test-macro 5)
   9: 1  (test-proc (* 5 5))

standard input:9:1: In expression (test-proc (* 5 5)):
standard input:9:1: Unbound variable: test-proc
ABORT: (unbound-variable)
guile> 


Here is a session with gauche, which gets this right:

gosh> (define-module test
  (export test-macro)
  (define (test-proc x) (write x) (newline))
  (define-syntax test-macro (syntax-rules () ((test-macro x) (test-proc (* x
x))))))
gosh> (import test)
#<undef>
gosh> test-macro
#<macro test-macro>
gosh> (test-macro 5)
25
#<undef>
gosh> 




    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?20941>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/



_______________________________________________
Bug-guile mailing list
Bug-guile@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-guile


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

end of thread, other threads:[~2009-07-20 21:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-31 12:41 [bug #20941] Modules interact badly with macros Andreas Rottmann
2007-10-31  0:23 ` Neil Jerram
2007-10-31  9:15   ` Ludovic Courtès
2009-07-20 21:35     ` Ludovic Courtès

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