[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-hackers] Strange macro expansion
From: |
Peter Bex |
Subject: |
Re: [Chicken-hackers] Strange macro expansion |
Date: |
Tue, 30 Jul 2013 21:04:32 +0200 |
User-agent: |
Mutt/1.4.2.3i |
On Tue, Jul 30, 2013 at 08:10:58PM +0200, Jörg F. Wittenberger wrote:
> ;; Hi All,
Hi, Joerg!
> ;; This looks wrong to me. I'd expect both tests to the same thing.
I believe this is similar to the following classic example:
(let ((else #f))
(cond (else 1))) ;; => void
Because else is lexically bound, it will not match the keyword literal.
>From R5RS (4.3.2):
``Identifiers that appear in <literals> are interpreted as literal
identifiers to be matched against corresponding subforms of the
input. A subform in the input matches a literal identifier if and
only if it is an identifier and either both its occurrence in the
macro expression and its occurrence in the macro definition have
the same lexical binding, or the two identifiers are equal and both
have no lexical binding.''
In this case, one has a lexical binding and the other has no lexical
binding (a free identifier). Therefore, it shouldn't match.
Cheers,
Peter
--
http://www.more-magic.net