-
Notifications
You must be signed in to change notification settings - Fork 3
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 #2
Comments
Not that this is from the god of Clojure: https://github.com/bbatsov/clojure-style-guide/blob/master/README.md#prefer-require-over-use Just a point of reference. |
":use" is apparently deprecated in favour of ":refer :all". I prefer
":use" because it's shorter and it's a straight syntactic shift when and
if :use is removed.
The main that people dislike :refer :all is that it raises the
possibility of name clashes, out of the control of the authors. So, for
example, in some namespace I might do
[tawny.owl :refer :all]
and find everything is happy. Then "clojure.core" might get updated and
introduce a function "only". Now my code is broken.
All valid concerns. But tawny is not a normal library -- it's more of an
application. I have entire namespaces with *no* clojure.core functions
in them at all. Having to type "(o/defclass blah)" to avoid a minor
problem in the future, which can be worked around using ":refer-clojure
:exclude [only]" seems silly. Or, as bbatsov says "Acceptable as
Warrented".
Phil
ChipNowacek <[email protected]> writes:
… Not that this is from the god of Clojure:
https://github.com/bbatsov/clojure-style-guide/blob/master/README.md#prefer-require-over-use
Just a point of reference.
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Any comment on
:use
vs:require
? I keep seeing recommendations to abandon:use
. I'm not clever enough to know exactly why.The text was updated successfully, but these errors were encountered: