On Thu, Sep 17, 2009 at 8:50 AM, Andrew Reilly <[email protected]> wrote: > On Thu, Sep 17, 2009 at 07:02:19AM -0400, Andre van Tonder wrote: >> (m) >> (define-syntax m (syntax-rules ((_) .....))) >> >> I /agree/ that M is lexically VISIBLE in the first line. >> But I /disagree/ that M should yet be bound to the macro when the first line >> is expanded. > > How could it be? Haven't you just been given an "undefined > identifier" or "unbound variable" error after the first > [return]? Surely all bets are off at that stage, and nothing is > going to go back and re-evaluate (m) after you type the second > line? >
It depends on whether you think `define'/`define-syntax' is a way of declaring variables that should be placed in a `letrec-syntax' containing a `letrec' surrounding the rest of the code, or if you think free variables are really free and just "caught" by a top-level environment/name->value mapping that may or may not have an initialized value for that variable name. If you think it's the former, and `define' is not restricted to the beginning of the sequence of expressions, then you might believe the first (m) will expand according to the definition following it. That's why it's not REPL-friendly. Hopefully I haven't mischaracterized the position of the "two-pass" camp. There could be more nuanced views. Lynn _______________________________________________ r6rs-discuss mailing list [email protected] http://lists.r6rs.org/cgi-bin/mailman/listinfo/r6rs-discuss
