[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug #31472] Probable psyntax bug with multiple defininitions in the mac
From: |
Göran Weinholt |
Subject: |
[bug #31472] Probable psyntax bug with multiple defininitions in the macro expansion |
Date: |
Sat, 21 May 2011 13:46:44 +0000 |
User-agent: |
Mozilla/5.0 |
Follow-up Comment #2, bug #31472 (project guile):
Hello guilers,
I want to note some problems that I suspect are caused by this bug. In
this example it looks like (define-foo foo1) and (define-foo foo2) use
the same identifier for `t' (the latter definition overrides the
first):
GNU Guile 2.0.1.79-a02a
Copyright (C) 1995-2011 Free Software Foundation, Inc.
Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'.
This program is free software, and you are welcome to redistribute it
under certain conditions; type `,show c' for details.
Enter `,help' for help.
scheme@(guile-user)> (library (temporaries-bug)
(export foo1 foo2)
(import (rnrs))
(define-syntax define-foo
(lambda (x)
(syntax-case x ()
((_ name)
(identifier? #'name)
#'(begin
(define t '(foo name))
(define (name) t))))))
(define-foo foo1)
(define-foo foo2))
scheme@(temporaries-bug)> ,m (guile-user)
scheme@(guile-user)> (import (temporaries-bug))
scheme@(guile-user)> (foo1)
$1 = (foo foo2)
scheme@(guile-user)> (foo2)
$2 = (foo foo2)
One can workaround this issue by using generate-temporaries. But that
doesn't work when (name) is syntax. Here I expect the library to
export syntax that can be used as (foo3), which would evaluate to the
list (foo foo3):
scheme@(guile-user)> (library (temporaries2-bug)
(export foo3 foo4)
(import (rnrs))
(define-syntax define-foo
(lambda (x)
(syntax-case x ()
((_ name)
(identifier? #'name)
(with-syntax (((t) (generate-temporaries
#'(name))))
#'(begin
(define t '(foo name))
(define-syntax name
(lambda (x)
(syntax-case x ()
((_) #'t))))))))))
(define-foo foo3)
(define-foo foo4))
scheme@(temporaries2-bug)> ,m (guile-user)
scheme@(guile-user)> (import (temporaries2-bug))
scheme@(guile-user)> (foo3)
;;; <stdin>:7:0: warning: possibly unbound variable `#{ g238}#'
<unnamed port>:6:0: In procedure #<procedure 1e50a00 at <current input>:7:0
()>:
<unnamed port>:6:0: In procedure module-lookup: Unbound variable: #{ g238}#
Entering a new prompt. Type `,bt' for a backtrace or `,q' to continue.
scheme@(guile-user) [1]>
_______________________________________________________
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,
Göran Weinholt <=