Using :refer 'sparingly'

2015-05-17 Thread Akiva
In Stuart Sierra's article here (http://stuartsierra.com/2015/05/10/clojure-namespace-aliases), he recommends to use :refer sparingly but doesn't explain why this is a good idea. Only thing I could think of without putting too much effort into it is that it makes it slightly more tedious when y

Re: Using :refer 'sparingly'

2015-05-17 Thread Max Countryman
I wonder if a reason could be to ensure it’s obvious where a function came from? For example (foo …) is ambiguous, it could be defined in the current namespace or it may have been referred from another whereas (my-ns/foo …) is explicit. > On May 17, 2015, at 08:04, Akiva wrote: > > In Stuart

Re: Using :refer 'sparingly'

2015-05-17 Thread Stuart Sierra
Just like the rest of the article, it's about readability. With `:refer` you don't know where a symbol came from when you encounter it in the middle of the code. –S On Sunday, May 17, 2015 at 4:05:14 PM UTC+1, Akiva Schoen wrote: > > In Stuart Sierra's article here > (http://stuartsierra.com

Re: Using :refer 'sparingly'

2015-05-17 Thread Akiva
Makes sense. I guess my other question then would be if there are any benefits to using :refer along with :as. :A. Stuart Sierra May 17, 2015 at 10:21 AMvia Postbox Just

Re: Using :refer 'sparingly'

2015-05-17 Thread Colin Yates
As stated in the article, I find the extra context of using :as aids maintenance more than you might expect. The only time I use refer is if the referred vars are conceptually owned, or the context is implicit by the name space using them. For me it is about responsibility and ignorance. :as implie

Re: Using :refer 'sparingly'

2015-05-17 Thread John Wiseman
There's a close parallel in Python, where the same issue comes up of typically using several modules or packages in a source file and the language offers a way to import the functions and classes of those modules in such a way that they can be used without any syntactic marker of their origin. For

Re: Using :refer 'sparingly'

2015-05-17 Thread Daniel Compton
I'm not sure if this is idiomatic, but I often like to refer any def* functions or macros, and :as alias the rest. I just prefer the visual look of a bare def without a prefix. There's usually only a couple of those in a codebase so it doesn't add too much overhead. On Mon, 18 May 2015 at 4:05 am J

Re: Using :refer 'sparingly'

2015-05-17 Thread Christopher Small
I agree with the general sentiment expressed here, but would just like to add that `:refer`-ing a few frequently used functions (as Colin Yates stated, particularly when it's assumed there is strong coupling or closeness between the two namespaces involved), is a much more minor nuisance than `

Re: Using :refer 'sparingly'

2015-05-18 Thread Luc Prefontaine
We systematically use refer all on tools.trace and a few other of our name spaces used for production support. It becomes handy in a live repl in production. Luc P. > I agree with the general sentiment expressed here, but would just like to > add that `:refer`-ing a few frequently used functi

Re: Using :refer 'sparingly'

2015-05-27 Thread Akiva
I've been using :refer [...] exclusively but I've been growing increasingly disenchanted with it; it's just a nuisance when you're interrupted by having to address the ns to add a command you didn't previously know you needed. On the other hand, not using :as can become just as much of a nuisan