On 09/14/2009 12:42 PM, Alaric Snell-Pym wrote:
> In summary, I think I agree, with the rationale that having one rule
> for everything - toplevels, REPLs, library bodies, and implicit or
> explicit begins, or as close as possible to the same rule for
> everything - provides "least surprise".
It's not that easy, I fear. You still need to handle forward
references:
(define (foo x) (if ... (bar x)))
(define (bar x) (if ... (foo x)))
The "traditional" behavior is that we treat the top-level
environment special, and dynamically: If we don't see a
lexical binding, punt to a run-time lookup. But that
doesn't work once we have libraries which have their
own internal namespace, which is distinct from the
dynamic top-level. At least it becomes a lot more
complicated. Unless we want to no longer support
mutually recursive functions or forward references of
functions inside libraries, which I think would be a shame.
There has to be some kind of 2-pass name lookup for
library bodies, as far as I can see.
--
--Per Bothner
[email protected] http://per.bothner.com/
_______________________________________________
r6rs-discuss mailing list
[email protected]
http://lists.r6rs.org/cgi-bin/mailman/listinfo/r6rs-discuss