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

Re: [Scheme-reports] ANN: first draft of R7RS small language available

On Sun, 24 Apr 2011, Aaron W. Hsu wrote:

> On Sun, 24 Apr 2011 15:50:15 -0400, Andre van Tonder <andre@x> 
> wrote:
>> On Sun, 24 Apr 2011, Aaron W. Hsu wrote:
>>> On Sun, 24 Apr 2011 15:34:23 -0400, Andre van Tonder <andre@x> 
>>> wrote:
>>>> 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!
>>> Even in systems where this is the case, and Chez in particular, this does 
>>> not do this.
>> I thinkthe reason Chez does not doi this is becasue you are replacing a 
>> syntactic binding for ELSE by a variable binding, so the DEFINE is not like 
>> a SET!.  IF the original binding of  ELSE was a variable binding, the 
>> define would be like a SET! and the ELSE clause would match.
> It does not matter whether the else is a syntactic binding or a variable 
> binding. Chez behaves the same in either case regarding this. Take this for 
> example:
>> (library (a)
>   (export test else)
>   (import (except (chezscheme) else))
>   (define-syntax test
>     (syntax-rules (else)
>       [(_ else) 'else] [(_ blah) #f]))
>   (define else #f))
>> (import (a))
>> (test else)
> else
>> (test x)
> #f
>> (define else #t)
>> (test else)
> #f
> The definition actually alters the lexical binding; library exports are 
> immutable, and thus a redefinition is more like a shadowing than a set!.

I agree with your example, but I was referring to the case where everything was 
at the top-level (no modules involved), where the behaviour is different.

Scheme-reports mailing list