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).

> 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.

>  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.

I'm sure you'll have many adventures on the way to a robust
implementation of this idea.  One more hint before you embark: defend
yourself from parallel loading.

-- 
Stephen Compall
^aCollection allSatisfy: [:each|aCondition]: less is better

-- 
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

Reply via email to