[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Chicken-janitors] Re: #444: Symbol lookup fails in modules in conjuncti
From: |
Chicken Trac |
Subject: |
[Chicken-janitors] Re: #444: Symbol lookup fails in modules in conjunction with renaming macros |
Date: |
Thu, 09 Dec 2010 11:52:26 -0000 |
#444: Symbol lookup fails in modules in conjunction with renaming macros
-----------------------+----------------------------------------------------
Reporter: syn | Owner:
Type: defect | Status: new
Priority: major | Milestone: 4.7.0
Component: expander | Version: 4.6.x
Resolution: | Keywords:
-----------------------+----------------------------------------------------
Old description:
> I stumbled upon a problem when trying to generate a
> {{{foreign-lambda}}} call in an IR macro. Somehow it failed to
> re-rename the injected {{{void}}} symbol correctly. This resulted in
> it referring to {{{#%void}}} aka {{{##sys#void}}}. The following
> reproduces the problem:
>
> {{{
> (import foreign)
>
> (foreign-declare "void foo() { printf(\"hi\\n\"); }")
>
> (module foo
> (bar)
> (import (except chicken void) scheme foreign)
>
> (define-syntax bar
> (ir-macro-transformer
> (lambda (x i c)
> `((foreign-lambda ,(i 'void) ,(i 'foo)))))))
>
> (import foo)
> (bar)
> }}}
>
> Note that it does work outside the module, though. So does the ER
> version:
>
> {{{
> (er-macro-transformer
> (lambda (x r c)
> `((,(r 'foreign-lambda) void foo))))
> }}}
>
> This might suggest that the problem lies within the IR macro
> implementation but sjamaan is almost certain that the symbol lookup
> must be going wrong somewhere and that it only fails in the IR version
> because there's more renaming taking place. Thinking about it some
> more he concluded that there is a chance that it's a problem in the IR
> implementation anyway. This ticket mainly serves as a reminder for him
> to think about that some more. However, other interested parties are
> welcome to contribute their thoughts as well, of course!
>
> P.S.: Mr Z. found out that {{{(import (except chicken void))}}} helps
> to make the IR version. This might be a work-around for people
> experiencing the same issue and looking for a work-around.
New description:
I stumbled upon a problem when trying to generate a
{{{foreign-lambda}}} call in an IR macro. Somehow it failed to
re-rename the injected {{{void}}} symbol correctly. This resulted in
it referring to {{{#%void}}} aka {{{##sys#void}}}. The following
reproduces the problem:
{{{
(import foreign)
(foreign-declare "void foo() { printf(\"hi\\n\"); }")
(module foo
(bar)
(import chicken scheme foreign)
(define-syntax bar
(ir-macro-transformer
(lambda (x i c)
`((foreign-lambda ,(i 'void) ,(i 'foo)))))))
(import foo)
(bar)
}}}
Note that it does work outside the module, though. So does the ER
version:
{{{
(er-macro-transformer
(lambda (x r c)
`((,(r 'foreign-lambda) void foo))))
}}}
This might suggest that the problem lies within the IR macro
implementation but sjamaan is almost certain that the symbol lookup
must be going wrong somewhere and that it only fails in the IR version
because there's more renaming taking place. Thinking about it some
more he concluded that there is a chance that it's a problem in the IR
implementation anyway. This ticket mainly serves as a reminder for him
to think about that some more. However, other interested parties are
welcome to contribute their thoughts as well, of course!
P.S.: Mr Z. found out that {{{(import (except chicken void))}}} helps
to make the IR version. This might be a work-around for people
experiencing the same issue and looking for a work-around.
--
Comment(by syn):
Oops, the original problem reproduction code contained the (except chicken
void) work-around which lead to it not reproducing the problem anymore. I
fixed this now!
--
Ticket URL: <http://bugs.call-cc.org/ticket/444#comment:9>
Chicken Scheme <http://www.call-with-current-continuation.org/>
Chicken Scheme is a compiler for the Scheme programming language.
- [Chicken-janitors] #444: Symbol lookup fails in modules in conjunction with renaming macros, Chicken Trac, 2010/12/08
- [Chicken-janitors] Re: #444: Symbol lookup fails in modules in conjunction with renaming macros, Chicken Trac, 2010/12/08
- [Chicken-janitors] Re: #444: Symbol lookup fails in modules in conjunction with renaming macros, Chicken Trac, 2010/12/08
- [Chicken-janitors] Re: #444: Symbol lookup fails in modules in conjunction with renaming macros, Chicken Trac, 2010/12/08
- [Chicken-janitors] Re: #444: Symbol lookup fails in modules in conjunction with renaming macros, Chicken Trac, 2010/12/08
- [Chicken-janitors] Re: #444: Symbol lookup fails in modules in conjunction with renaming macros, Chicken Trac, 2010/12/08
- [Chicken-janitors] Re: #444: Symbol lookup fails in modules in conjunction with renaming macros, Chicken Trac, 2010/12/08
- [Chicken-janitors] Re: #444: Symbol lookup fails in modules in conjunction with renaming macros, Chicken Trac, 2010/12/08
- [Chicken-janitors] Re: #444: Symbol lookup fails in modules in conjunction with renaming macros, Chicken Trac, 2010/12/09
- [Chicken-janitors] Re: #444: Symbol lookup fails in modules in conjunction with renaming macros,
Chicken Trac <=
- [Chicken-janitors] Re: #444: Symbol lookup fails in modules in conjunction with renaming macros, Chicken Trac, 2010/12/09
- [Chicken-janitors] Re: #444: Symbol lookup fails in modules in conjunction with renaming macros, Chicken Trac, 2010/12/09
- [Chicken-janitors] Re: #444: Symbol lookup fails in modules in conjunction with renaming macros, Chicken Trac, 2010/12/09
- [Chicken-janitors] Re: #444: Symbol lookup fails in modules in conjunction with renaming macros, Chicken Trac, 2010/12/11