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