chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] bug(?) in macroexpansion


From: Felix Winkelmann
Subject: Re: [Chicken-users] bug(?) in macroexpansion
Date: Wed, 07 May 2003 11:00:19 +0200
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.0.0) Gecko/20020530

Panagiotis Vossos wrote:
I am using chicken 1.0 and I think there is a bug in the way macros
are expanded when hygenic macros are in use.  I don't have chicken
running on this machine right now, but I remember that if you define a
macro like:

(define-syntax foo
  (syntax-rules ()
    ((_ x) (+ "baz" x))))

, then (foo 10) gets expanded as:

(+ '"baz" '10)

when it should be:

(+ "baz" 10).

I came across this when trying to compile library.scm with -hygienic
and it complained about incorrect use of inline_allocate or something.

Am I missing something or is it indeed a bug?


It's not really a bug. The syntax-case expander automatically
quotes all constants, so if you try

>>> ,x (foo "baz" abc)

Your will get

(+ '"baz" abc)

i.e. the expander is fully aware of what has to be quoted and what
not. This *might* give problems with certain Chicken-specific
forms that use non-evaluated arguments (I just stumbled across
an issue with `define-constant' a couple of days ago).
Apparently `inline_allocate' has to be changed to handle this
behaviour, too. Perhaps more special forms have to be adapted.

Thanks for the tip.


cheers,
felix





reply via email to

[Prev in Thread] Current Thread [Next in Thread]