On Sun, Oct 9, 2011 at 8:48 AM, Stephen Compall <stephen.comp...@gmail.com> wrote: > On Fri, 2011-10-07 at 19:07 +0530, Vivek Khurana wrote: >> I would prefer to have a >> modules directory where each module will create a sub directory and >> all files in the module sub directory expose a single namespace. > > So it sounds like you intend for module writers to be writing Clojure, > but want to replace the standard way namespaces are done in Clojure > (i.e. ns form at top of file).
Not just clojure. Solution for clojure only code is simple. The application is a framework, which will expose some API and modules consuming the API, can be written in any JVM language. It is known that all modules will run from same instance of JVM. The issue is that I should be able to distinguish between the modules written by core team and modules written by others and cannot figure out the correct way to manage namespaces in this situation. > >> When ever I try to use AOT I get errors. > > You should avoid AOT for this; indeed, perhaps modules shouldn't even go > in the src/ directory, assuming you are using Leiningen or something > with similar structure. Yes I am using Leiningen. Do you suggest I should host the modules out side the src ? Wont that create a classpath havoc ? Secondly, in case the modules are outside src, how will they compile ? Do I need to make any changes to Leingen configuration ? > >> Also, is there a better way to manage namespaces in modular >> applications. I do not want the developers of modules to struggle with >> managing files and namespaces. > > If you wish to replace the standard Clojure conventions for managing > files and namespaces, as codified by `require' and its ilk, these items > will help you on your adventure: > > clojure.core/*ns* > A clojure.lang.Namespace object representing the current namespace. > > clojure.core/load > ([& paths]) > Loads Clojure code from resources in classpath. <snip> > > clojure.core/load-file > ([name]) > Sequentially read and evaluate the set of forms contained in the file. > > You could bind `*ns*' to a namespace you construct yourself while > loading the files that make up a module, in a guaranteed order of > course. It might be difficult to guarantee the order when number of modules increase... regards Vivek -- The hidden harmony is better than the obvious!! -- 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 Note that posts from new members are moderated - please be patient with your first post. 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