-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
use vs require #1
Comments
+1 I don't know how closely you guys follow the mailing list, but avoiding the use of |
Agreed. But if you take a look at the file at https://github.com/Prismatic/plumbing/blob/master/src/plumbing/core.clj, you'll see that it's full of things like As for |
I don't think pre-1.4 is in use nearly enough at this point for it to really matter, but regardless, that's why I suggested adding a note about it if it is a concern. Not having to fix all this code when In any case, these are merely polite suggestions. You guys are certainly entitled to your own engineering best practices (everybody has some!), but since this is a public thing now I just wanted to provide some counterpoints! Cheers! |
I would also take the opportunity to mention that if you have a large number of nouns/verbs in a single namespace for some kind of DSL, I would be quite unhappy if I was looking at code that had dissoc-in but didn't have a namespace prefix in front of it to warn me I wasn't looking at clojure.core. Code that forces you to exclude multiple things from clojure.core is not generally speaking well designed code. |
Howdy. Just wanted to suggest not promoting the use of
:use
.As of Clojure 1.4,
require
serves both its original purpose and the purpose ofuse
via the:refer
modifier. For exampleIf compatibility with pre-1.4 is not a requirement, this is generally a better way to go. It makes
ns
declarations far more consistent and uniform, and also means there is less code usinguse
if it gets deprecated at some point in the future (which would not be entirely unsurprising).My suggestion would be to replace the
use
uses (no pun intended) withrequire
, but add a note aboutuse
for the unlikely event that the reader requires < 1.4 compatibility.As a secondary thing, it isn't really great to promote these unqualified imports. In tests and such it is generally fine, but in actual code you almost always want to qualify things for readability and clarity. It seems to be trying to say this, but it doesn't feel clear enough. I'd be more aggressive in saying that it's almost always a bad idea to do unqualified imports. I don't know what
plumbing.core
is and whether or not it is a good example of an exception though.Cheers!
The text was updated successfully, but these errors were encountered: