clojure-style-guide icon indicating copy to clipboard operation
clojure-style-guide copied to clipboard

Addition: no naked use or require/refer-all

Open CampingScorpion opened this issue 12 years ago • 4 comments

CampingScorpion avatar Jan 05 '13 22:01 CampingScorpion

Will do.

bbatsov avatar Jan 08 '13 09:01 bbatsov

That said, as Technomancy pointed out, it is pretty standard to test files naked using or require/referring clojure.test and the ns under test. Maybe we could mention that in the style guide.

CampingScorpion avatar Jan 08 '13 10:01 CampingScorpion

Prefer using :require :refer :all over :use in ns macro.

:refer :all is better than :use. However it is even better using refer explicitly like :refer [func-name].

I would like to suggest change it to

Prefer using :require :refer [func-name], in case of referring to all functions in a namespace, use :require :refer :all, instead of :use.

tendant avatar May 17 '14 20:05 tendant

But is there a solid argument to using :require :refer :all over :use? I mean, if they do the same thing, :use seems more readable.

Definition of use calling to refer: https://github.com/clojure/clojure/blob/43cc1854508d655e58e377f84836ba128971f90c/src/clj/clojure/core.clj#L5727-L5736

film42 avatar Aug 09 '14 17:08 film42