kawa-commonlisp-dev
[Top][All Lists]
Advanced

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

Re: [Kawa-commonlisp-dev] [GSoC] Status


From: Helmut Eller
Subject: Re: [Kawa-commonlisp-dev] [GSoC] Status
Date: Sat, 11 Aug 2012 09:06:45 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1.50 (gnu/linux)

On Sat, Aug 11 2012, Jamison Hope wrote:

>> I made a smaller test case that, to me, demonstrates a hygiene
>> problem:
>> [...]
>> Any pointers on where to look for the difference? I'm struggling to
>> figure out how where the bindings are actually looked up, and actually
>> I'm not sure if DEFMACRO is functioning correctly and that I must
>> instead use define-syntax.
>
>
> It looks like DEFMACRO macros are having trouble looking up
> non-exported symbols defined in their lexical environments.
> To be honest, I'm not positive what's supposed to happen here,
> either, but my reading of the HyperSpec says your test1 is
> supposed to work.
>
> CLHS says that DEFMACRO "Defines name as a macro by associating a macro
> function with that name in the global environment. The macro function
> is defined in the same lexical environment in which the defmacro form
> appears."
>
> The "same lexical environment" part to me says that it should be able
> to find the function NONSENSE, but maybe the contract only applies to
> stuff appearing outside of the quasiquote, not sure.
>
> Helmut, what's the right behavior for DEFMACRO?

Normally CL has no modules and therefore NONSENSE is a function in the
(one-and-only) global environment even if the symbol NONSENSE is not
exported from it's package.  Scheme has modules and syntax-case, as
opposed to DEFMACRO, has special machinery to support those uses of
names that are not exported from the module.

A macro defined with DEFMACRO will just return the symbol NONSENSE, and
the compiler/loader will search for it in the global environment.  I
guess the problem with Kawa is that NONSENSE doesn't end up in the global
environment because it's not exported from the module.

A macro defined with syntax-case returns an identifier (that's not a
symbol but some more complicated thing) that carries additional
information, in particular the module it belongs to.

Helmut




reply via email to

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