[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug #20941] Modules interact badly with macros
From: |
Andreas Rottmann |
Subject: |
[bug #20941] Modules interact badly with macros |
Date: |
Fri, 31 Aug 2007 12:41:49 +0000 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.6) Gecko/20070723 Iceweasel/2.0.0.6 (Debian-2.0.0.6-1) |
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/
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [bug #20941] Modules interact badly with macros,
Andreas Rottmann <=