@Richard: Yes, I think that makes sense.  I am running into dependency
problems when I try to split up the namespace -- my split-up files
have a hard time refering to each other.  So I think that
file-per-namespace is the answer.

@Sean: yes I will probably compile the app to a jar at some point.
The idea is that there will be a separate clj file for configuration,
that lives outside the jar.  At runtime, the config file will get read
in and run.

On Fri, Feb 5, 2010 at 6:21 PM, Richard Newman <holyg...@gmail.com> wrote:
>> It might be helpful if the documentation at
>> http://clojure.org/namespaces mentioned how to split out a namespace into
>> multiple files.
>
> I never split a namespace into multiple files: I split my project into
> multiple namespaces.
>
> That way I can simply :require and :use them from each other, and let the
> dependency system take care of loading.
>
> In your case, I'd have:
>
> ;; foo/main.clj
> (ns foo.main (:use foo.a foo.util))
>
> (defn main []
>  (print "hello from main\n")
>  (aaa "FOO-MAIN")
>  (util "FOO-MAIN"))
>
> (main)
>
> ;; foo/a.clj
> (ns foo.a (:use foo.util))
>
> (defn aaa [arg]
>  (print (format "hello from aaa: %s\n" arg))
>  (util "FOO-A"))
>
> ;; foo/util.clj
> (ns foo.util)
>
> (defn util [arg]
>  (print (format "hello from util: %s\n" arg)))
>
>
> To make all this directly executable, add (:gen-class) to the main ns, and
> specify foo.main as the Main-Class in your jar.
>
> --
> 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

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