[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Scheme-reports] ANN: first draft of R7RS small language available
On Fri, Apr 22, 2011 at 12:25 AM, Aaron W. Hsu <arcfide@x> wrote:
> I am actually really curious about this. In every implementation with
> which I am familiar, importing a binding from a library results in the
> same lexical binding. I believe that Andre's second example with MATCH is
> an interesting one and I am interested to know how you deal with such a
> thing in Chibi. In fact, could you explain in detail how such an
> implementation works when it doesn't actually result in the same lexical
> bindings? How can it make the match example work?
Of course this works in Chibi. My own `match' macro, which
is used pervasively in Chibi and Chicken, does the same thing.
When I said that Chibi matches as though all identifiers are
unbound in the top-level, that was just one way of looking at
it which lets me claim compatibility without changing the
text of the syntax-rules literal matching rule:
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.
Another way of looking at this is to change that rule with
s/lexical/local/g. In other words, all top-level bindings are
equivalent for the purpose of literal matching.
The implications for this are that while
(let ((else #f))
(cond (else (display "else clause matched"))))
is required to not display anything as in R5RS,
(define else #f)
(cond (else (display "else clause matched")))
would display "else clause matched". Because the
else is not local to the usage in question, I think this
is the more intuitive behavior.
I am of course not advocating this for the standard,
I'm just describing one implementation strategy that
if at all possible I'd prefer the standard to be compatible
I'm not yet advocating _anything_ for the standard,
I'm just trying to consider all the possibilities before
making a decision :)
Scheme-reports mailing list