On Sep 14, 2009, at 7:59 PM, Brian Harvey wrote: >> There has to be some kind of 2-pass name lookup for >> library bodies, as far as I can see. > > As the Smalltalk people used to say, "You can cheat, but don't get > caught." > (This was for things like optimizing numbers to behave as if they > weren't > also objects when you do arithmetic on them.) It means, compilers can > optimize as aggressively as they want, as long as they don't change > the > semantics away from the simple uniform meaning. > > In our case, I think the simple uniform meaning is the one that an > interpreter without much optimization would take: Don't look inside a > lambda expression at all until the procedure is invoked. > > I can see why a compiler would want to cheat about this, and know the > bindings of symbols while compiling a not-yet-called procedure, and so > might want to look ahead. But it has to not get caught, i.e., the > meaning of the program has to be the same as for that simple-minded > interpreter.
None of this has to do with interpretation versus compilation. It has only to do with scoping rules. The rules are the same regardless of implementation strategy. An implementation of the R5RS must provide lexical scope, hygienic macros, and internal definitions. This is just about nailing down the rules for how all this interacts while also extending the semantics to include internal syntax definitions. - and about making sure that a macro author can write (begin (a) (b) (c) ...) and have it mean the same thing in all contexts. Isn't lexical consistency a Good Thing? -- Brian Mastenbrook [email protected] http://brian.mastenbrook.net/ _______________________________________________ r6rs-discuss mailing list [email protected] http://lists.r6rs.org/cgi-bin/mailman/listinfo/r6rs-discuss
