On Sep 21, 2014, at 5:11 AM, Robert Tweed <fistful.of.spann...@gmail.com> wrote:
> In short: use 'use' in the repl or any time you're generally feeling lazy. 
> Don't use it in non-throwaway code.
> 
> Use automatically refers everything in a namespace. This is handy if you 
> don't want to type out the names, but it creates two few problems:
> 
> 1. It increases the chances of a conflict when the same name appears in more 
> than one namespace.
> 
> 2. As an extension to (1) it creates forward compatibility problems, where 
> the namespaces you are importing change; so on day one your code works fine, 
> but on day 2 it doesn't, because someone (possibly outside your control) 
> added a new item to one of the namespaces you are importing with use, that 
> now conflicts with one of the others.
> 
> 3. It makes your code less readable, because if you use some "foo", then 
> anyone that isn't familiar with "foo" won't know which namespace you imported 
> it from (or might think it came from a different namespace than it actually 
> did). When you explicitly refer each "foo", "bar", etc., it's easy to see 
> where they came from (by reading just your code and without having to go 
> searching around in other files).

I sort of agree with the bottom line here, but there are "non-throwaway" 
contexts in which (2) won't apply because you are only "use"ing your own 
namespaces, and in which the overall project is small enough that the chances 
of conflict in (1) are acceptably small and the clutter of namespace 
annotations makes things less rather than more readable (contradicting (3)).

And the relative lack of ceremony of "use" is, IMHO, sometimes quite desirable. 

 -Lee 

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to