[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug #31472] Probable psyntax bug with multiple defininitions in the mac
From: |
Andreas Rottmann |
Subject: |
[bug #31472] Probable psyntax bug with multiple defininitions in the macro expansion |
Date: |
Tue, 26 Oct 2010 20:42:28 +0000 |
User-agent: |
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.8) Gecko/20100820 Iceweasel/3.6.8 (like Firefox/3.6.8) |
URL:
<http://savannah.gnu.org/bugs/?31472>
Summary: Probable psyntax bug with multiple defininitions in
the macro expansion
Project: Guile
Submitted by: rottmann
Submitted on: Tue 26 Oct 2010 10:42:27 PM CEST
Category: None
Severity: 3 - Normal
Item Group: None
Status: None
Privacy: Public
Assigned to: None
Open/Closed: Open
Discussion Lock: Any
_______________________________________________________
Details:
Given the following library:
(library (unbound-bug)
(export define-foo)
(import (rnrs))
(define-syntax define-foo
(lambda (x)
(syntax-case x ()
((_ name)
(identifier? #'name)
#'(begin
(define t '#(1 2 3))
(define (name) t)))))))
I get this (what I deem faulty) behavior:
scheme@(guile-user)> (import (unbound-bug))
scheme@(guile-user)> (define-foo bar)
scheme@(guile-user)> (bar)
<unnamed port>:2:1: In procedure module-lookup:
<unnamed port>:2:1: Unbound variable: t
Entering a new prompt. Type `,bt' for a backtrace or `,q' to continue.
scheme@(guile-user) [1]>
If one modifies the original macro slightly, it works as expected:
(define-syntax define-foo
(lambda (x)
(syntax-case x ()
((_ name)
(identifier? #'name)
(with-syntax ((t (datum->syntax #'name 't)))
#'(begin
(define t '#(1 2 3))
(define (name) t))))))))
scheme@(guile-user)> (define-foo bar)
scheme@(guile-user)> (bar)
$1 = #(1 2 3)
Also (with the original macro), this works:
scheme@(guile-user)> (let () (define-foo bar) (bar))
$1 = #(1 2 3)
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?31472>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [bug #31472] Probable psyntax bug with multiple defininitions in the macro expansion,
Andreas Rottmann <=