Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
No reason to avoid single-segment namespaces. #100
Clojure namespaces with
Yeah, this is why we introduced this rule in the first place. What you're saying sounds reasonable, but I'd like to do some digging first (and perhaps hear more comments).
Btw, probably it still makes some sense to suggest that projects should use multi-segment namespaces when they have more than a single namespace. I also have a feeling people are abusing the
referenced this pull request
Mar 11, 2015
Namespaces exist to disambiguate names. Using a single segment namespace puts you in direct conflict with everyone else using single segment namespaces, thus making it more likely you will conflict with another code base.
So, for libs, I think it's a very good idea to use a first segment for context vs every other lib you might include. Within your own private app of course, you can do whatever you like. :)
Single segment namespaces have problems in ClojureScript as well.
You'll get warnings in ClojureScript by default when compiling single segment namespaces.
IMO everything in the design of Clojure, the JVM, and ClojureScript seems to be pushing away from single segment namespaces. The only benefit from single segment namespaces (I think?) is a slightly more elegant ns declaration. While that's nothing to be sniffed at, IMO it's not a big enough gain. People can do whatever they want in their own code, but in the de facto style guide for Clojure, I think single segment namespaces should be avoided.