This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-04-06
Channels
- # admin-announcements (17)
- # beginners (78)
- # boot (162)
- # braid-chat (2)
- # cider (20)
- # cljs-dev (9)
- # cljsjs (41)
- # cljsrn (17)
- # clojure (98)
- # clojure-austin (5)
- # clojure-brasil (1)
- # clojure-dusseldorf (1)
- # clojure-greece (1)
- # clojure-ireland (2)
- # clojure-italy (1)
- # clojure-japan (5)
- # clojure-russia (128)
- # clojure-uk (2)
- # clojurescript (29)
- # core-async (1)
- # core-logic (7)
- # css (1)
- # cursive (12)
- # datomic (18)
- # devcards (1)
- # dirac (6)
- # emacs (31)
- # funcool (28)
- # hoplon (208)
- # jaunt (66)
- # jobs (1)
- # juxt (6)
- # lein-figwheel (14)
- # off-topic (9)
- # om (83)
- # om-next (6)
- # onyx (63)
- # overtone (1)
- # parinfer (2)
- # protorepl (23)
- # re-frame (27)
- # reagent (14)
- # ring-swagger (8)
- # slack-help (2)
- # spacemacs (1)
- # untangled (56)
From Clojure for the Brave and True: "It’s frowned upon to use use in production code” - may I ask why this is the case? Why is this better/worse than using require/refer or include it from :require in the (ns …) declaration?
Sorry, that was a bit succint. This is about namespaces and learning to use them, including require
, use
, refer
and ns
After explaining use
, the book says "It’s frowned upon to use use
in production code”, and I was just wondering why.
Maybe it’s best to ask @nonrecursive directly what he meant 😉
@zzamboni: There are several reasons to this. I think the biggest one is that use
imports everything from that namespace, which may override other declarations. For me, the biggest reason to use (:required [foo.bar :as b]) is that there is such a good tooling support around it in cursive.
the library ring uses this, and they call it from (:import [org.apache.commons.fileupload …)
so i would be calling it (:import [org.apache.commons.fileupload …) like the ring library does right?
@zzamboni: another reason is that often I’ll want to look up a function to see what it does, and if that function was added via use
then it’s more difficult to pull up the function’s namespace
@nonrecursive: thanks, another good point
what’s the clojure equivalent of FileItemFactory factory = new DiskFileItemFactory(fContent.length(), null);
FileItemFactory factory = new DiskFileItemFactory(fContent.length(), null); this.item = factory.createItem("field1", " text/html", true, "temp.txt");
so i guess if these 2 lines are inside a public class blabla it probably refers to blabla?
I suggest you read this chapter http://www.braveclojure.com/java/