On Thu, Sep 17, 2009 at 09:18:56AM -0400, Andre van Tonder wrote: > On Thu, 17 Sep 2009, Andrew Reilly wrote: > > >On Thu, Sep 17, 2009 at 07:02:19AM -0400, Andre van Tonder wrote: > >> > >>Again, as I have said many times and even explained with examples, I am > >>not > >>contesting the visibility rules at the toplevel for macros. In the > >>following > >>toplevel sequence typed at a REPL > >> > >> (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]? > > You are confusing visibility with extent. Consider in R6RS > > (let () > (define y x) > (define x 1) > ....) > > Here the region of visibility of the x binding is the entire body, but > the above is still an error, because the reference to x in the > first definition is not within the dynamic extent of the binding.
Exactly. (m) typed into a REPL at the top level, as in the quoted example, has to produce an error, because it is asking m to be evaluated before it has been defined. I might not go on and define m as syntax, as in the next line of the example. Cheers, -- Andrew _______________________________________________ r6rs-discuss mailing list [email protected] http://lists.r6rs.org/cgi-bin/mailman/listinfo/r6rs-discuss
