Why do Many Clojure Projects Have a "core" Namespace?
Project Names and "core" Namespaces in Clojure
Almost every Clojure project seems to have a core
namespace. This is something that lein new project-name
creates, and people just go with the flow.
I don't like this, and it turns out I'm not the only one. See Where does the "core" namespace nomenclature derive from? for some discussion.
Leiningen does different things depending on the type of name you give it. I can't make a lot of sense of this, but here's what my playing has revealed (with Leiningen 2.7.1).
A Simple Name
(This is what most people seem to do.)
lein new simple-name
Creates a directory named
simple-name
with a project namedsimple-name
.Creates namespaces named
simple-name.core
andsimple-name.core-test
.
If you do this, please immediately delete the namespaces and then create other ones with better names.
A reverse-domain-name/name -Style Name
(I think I plan to mostly do this in future.)
lein new com.backwards.domain/my-name
Creates a directory named
my-name
with a project namedcom.backwards.domain/my-name
.Creates namespaces named
com.backwards.domain.my-name
andcom.backwards.domain.my-name-test
.
An x.y Name
lein new foo.bar
Creates a directory named
foo.bar
with a project namedfoo.bar
.Creates namespaces named
foo.bar
andfoo.bar-test
.