On Feb 14, 2009, at 3:09 PM, Dan Larkin wrote:
But thinking about it more, would it be possible to emulate the way python handles circular dependencies? When a file is imported in python the interpreter "evaluates" top-level forms to create a list of exports. Of course the clojure reader has fundamental differences from the python reader, but couldn't clojure do something similar? After all, (read (PushbackReader. (StringReader. "(def a (foo 5))"))) just returns a list, couldn't each (require )'d namespace be read, searched for exports and dependencies (which would have the same thing done to them) and then they could be evaluated? That way all the vars necessary for "linking" are present.
One problem with that is that in Clojure, things you define in other namespaces (macros) can be used *at compile time* in compiling your code. That's fundamentally different from less dynamic languages. Reading about the solution to this in (say) the rationale for the R6RS Scheme spec may at least give us an idea of how hard the problem is we're trying to solve.
--Steve
smime.p7s
Description: S/MIME cryptographic signature