On Feb 14, 2009, at 2:14 PM, Stephen C. Gilardi wrote:

>
> On Feb 14, 2009, at 1:40 PM, Dan Larkin wrote:
>
>> But as an aside, does this seem to anyone else like a wart on an  
>> otherwise great language? Thinking about file layout should not be  
>> one of my priorities... the language should not encourage me to put  
>> everything together in one file just to get it to work.  I should  
>> be able to separate functionality in a way that makes sense to the  
>> app I'm building.
>
> Within one namespace, we use declare to avoid this problem. Perhaps  
> declare could be extended (or another function created) to work with  
> namespace-qualified symbols that refer to namespaces and vars that  
> may not yet exist. I would imagine this would involve creating the  
> namespace and var within it if either didn't yet exist and pushing  
> the namespace name onto some "deferred load" queue so it's  
> guaranteed loaded by the time the top level load is complete.
>
> For this to be effective in our preferred way to declare  
> dependencies, it should be a new clause in within "ns".
>
> Any thoughts?


What you describe is the first way I thought about it.  Some sort  
of :external-depends or something...

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.

Dan
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to