I have read in several places that single segment namespaces are discouraged in clojure.
Indeed almost every library I've seen has (require 'lib.core) instead of (require 'lib).
Why?
Edit: I am a bit stupid. Extra credit will be given for a concise example of how a single segment namespace might be a bad thing.
Java discourages the use of the default package because you can't refer to anything in it from any other package. If you pre-compile a one-segment Clojure namespace, you'll get a Java class in the default package. If anyone at any time wants to use your library from Java, he will be stopped dead by this triviality. As there is no good reason in favor of using a single-segment namespace, and there is this one well-defined reason not to, it is fair to say that single-segment namespaces should be a discouraged practice in Clojure.
Single segment namespaces have issues with Java interop. Some things may break in unexpected ways. See also https://groups.google.com/forum/?fromgroups=#!topic/clojure/gOffhotk25Y
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With