On 25 March 2011 01:05, Terje Dahl <te...@terjedahl.no> wrote:
> In Java, the language forces you to have more or less one class pr
> class-file, and you are encouraged to group class-files in packages.
> So, is it as simple as saying that that namespaces are analogous to
> class-files, and clj-files are analogous to packages?

Typically, each .clj file will have its own namespace. Clojure uses
the namespace to find where the corresponding .clj file is on the
classpath.

> Also, while we are at it, what are the naming conventions?
> The same as in Java packages?
> So I would use:  "no.terjedahl.some.namespace.here" ?

Some people use this convention, but the majority of Clojure libraries
tend to use the following convention:

  library-name.some.namespaces

For instance, here are some namespaces for the Ring library:

  ring.middleware.params
  ring.util.response

You can use namespaces of only one part, such as "lancet", but this
will result in class-files without a package. As I understand it, this
is generally discouraged, so in the cases where a library only needs
one namespace part, a ".core" is usually appended, e.g. "clout.core".

I don't think there are any official recommendations, but these are
the conventions used by many Clojure libraries, and build tools like
Leiningen.

- James

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