gcl-devel
[Top][All Lists]
Advanced

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

Re: [Gcl-devel] SYMBOL-MACROLET problem


From: Camm Maguire
Subject: Re: [Gcl-devel] SYMBOL-MACROLET problem
Date: 29 Oct 2002 20:54:17 -0500

Hi Paul, and thanks.  I agree we need a new symbol-macrolet.  I'm
trying to decide whether to roll our own or take one from, say, cmucl.
I've looked briefly at cmucl, and the implementation seems bound up
with the compiler, and therefore hard to extract.  Apart from this
question, I'm wondering if it is possible to practically address this
at the lisp level.  GCL currently does macroexpansion in C.  Can you
elaborate a little on your suggestion below to implement this "at the
same place" as ordinary macroexpansion?  Is there some sort of subtle
interplay between symbol-macrolet and macroexpand?  From your note,
and what I read in the spec, my current understanding is that what
this should do is simply go through the code as a list, make all
substitutions not shadowed by an internal let, and then pass the
result out for normal evaluation.  I must confess that my grasp on
lisp evaluation is still rather primitive, however.

Advice appreciated.

Take care,

"Paul F. Dietz" <address@hidden> writes:

> I wrote:
> 
> > I think the proper way to fix this is to rip out the PCL implementation
> > of symbol-macrolet and instead do symbol-macrolet expansion in the same
> > place ordinary macroexpansion is performed.  The PCL implementation is
> > something of a hack, and I don't think it can be made correct in general
> > (the generic problem is that it 'manually' macroexpands subterms during
> > the code walk, but those subterms don't have symbol-macro substitution
> > performed on them, so if the macro inspects the results of such expansion
> > it sees the wrong thing.)
> 
> I've added a test that shows the problem in PCL's symbol-macrolet.
> It's macrolet.13, in ansi-tests/macrolet.lsp.  The test is:
> 
> (deftest macrolet.13
>    (symbol-macrolet ((a b))
>      (macrolet ((foo (x &environment env)
>                      (let ((y (macroexpand x env)))
>                        (if (eq y 'a) 1 2))))
>        (foo a)))
>    2)
> 
> gcl expands FOO before substituting for A, and so incorrectly yields
> 1 instead of 2.
> 
>       Paul
> 
> 
> 
> _______________________________________________
> Gcl-devel mailing list
> address@hidden
> http://mail.gnu.org/mailman/listinfo/gcl-devel
> 
> 

-- 
Camm Maguire                                            address@hidden
==========================================================================
"The earth is but one country, and mankind its citizens."  --  Baha'u'llah




reply via email to

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