On Sep 13, 2009, at 2:59 PM, Andre van Tonder wrote:

> On Sun, 13 Sep 2009, John Cowan wrote:
>
>> Abdulaziz Ghuloum scripsit:
>>
>>> I think one-pass gives you an approximation of let*-scoping
>>> semantics while two-pass gives you recursive bindings.  For
>>> example, the following expression
>>>
>>> (let-syntax ((f (syntax-rules () ((_) 1))))
>>>   (let ()
>>>     (define (g) (f))
>>>     (define (f) 2)
>>>     (g)))
>>>
>>> evaluates to 1 in one-pass since at the time (f) is expanded,
>>> only the outer f is known.  In two-pass, it evaluates to 2
>>> since (f) is expanded after the shadowing definition of f is
>>> found.
>>
>> On my system, at least, Bigloo returns 1; PLT, Gauche, Chicken, scsh,
>> Kawa, SISC, and Petite Chez all return 2; and Gambit and Guile return
>> syntax errors.  None of these systems, AFAIK, are two-pass in the  
>> sense
>> of R6RS.
>
> For 1-pass systems, Gambit and Guile would be correct.  Bigloo is
> in violation of lexical scope and is therefore incorrect.
>
> Some of the systems that return 2 are definitely 2-pass in the sense  
> of
> R6RS (Petite, PLT, and other based on psyntax).

No. The R5RS requires this to return 2, as does the R6RS. The scope of  
internal definitions has nothing to do with one-pass versus two-pass.  
In both systems, the example that Aziz gave must return 2. Any system  
in which it doesn't is broken.

It's worth noting that the R5RS does not allow internal `define- 
syntax', and thus a conforming implementation of the R5RS may be  
either one-pass or two-pass.

The following example will distinguish one-pass implementations from  
two-pass implementations:

(let-syntax ((f (syntax-rules () ((_) 1))))
   (let ()
     (define g (f))
     (define-syntax f (syntax-rules () ((_) 2)))
     g))

Scheme48, Gauche, and Larceny (R5RS mode) error as they do not support  
inner `define-syntax'. PLT and Gambit are two-pass. Chicken is one-pass.
--
Brian Mastenbrook
[email protected]
http://brian.mastenbrook.net/

_______________________________________________
r6rs-discuss mailing list
[email protected]
http://lists.r6rs.org/cgi-bin/mailman/listinfo/r6rs-discuss

Reply via email to