[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, 22 Apr 2011, Alex Shinn wrote:

> 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:

But then you would be incompatible with 5.2.1 on p 19, which describes the 
sematics of toplevel DEFINE as a binding form if the identifier is previously 
unbound.  SO only trivial programs would have all toplevel identifiers unbound.

> 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".

The latter behaviour may be compatible with the document in systems in which all 
identifiers are considered implicitly bound at toplevel, so the DEFINE would be 
like a SET!  However, many many people are going to find that surprising, 
because if you put it in a body:

  (let ()
    (define else #f)
    ...
    (cond (else (display "else clause matched"))))

then suddenly the ELSE clause will not match.

_______________________________________________
Scheme-reports mailing list
Scheme-reports@x
http://lists.scheme-reports.org/cgi-bin/mailman/listinfo/scheme-reports