On Sep 15, 2009, at 9:31 PM, Ray Dillinger wrote:

> On Tue, 2009-09-15 at 19:45 -0400, Aaron W. Hsu wrote:
>
>> Keep in mind that the desired semantics in a perfect world are  
>> closer to
>> the internal library body in R6RS or the top-level program  
>> semantics, and
>> the semantics of the REPL are an unfortunate necessity because we  
>> must
>> evaluate every form that we encounter as we encounter it. It is  
>> much nicer
>> to be able to evaluate each definition in the same scope and have  
>> LETREC
>> or LETREC* semantics.
>
> This is why I argue that the proper time for expansion of macro calls
> is the first time the code containing them is executed.  That is the
> only way you achieve LETREC or LETREC* - like semantics that are
> consistent between macro invocations and function calls.
>
> The semantics of the REPL are not an "unfortunate necessity."  They
> are a clear proof that the "Right Thing" in terms of semantic
> consistency is not served by a separation of phases.
>
> If you design for a separation of phases anyway, then your design
> is going to have semantic inconsistencies.  *That* is the
> unfortunate necessity.


I don't understand why the time when macros are expanded has anything  
to do with the scoping rules of the language, unless you're trying to  
do things which are not possible in a lexically scoped environment.
--
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