This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2015-06-24
Channels
- # admin-announcements (5)
- # beginners (19)
- # boot (48)
- # cider (36)
- # clojure (116)
- # clojure-berlin (2)
- # clojure-italy (2)
- # clojure-japan (40)
- # clojure-russia (11)
- # clojure-sg (2)
- # clojure-spain (11)
- # clojurescript (53)
- # docs (2)
- # editors (14)
- # euroclojure (57)
- # events (2)
- # instaparse (11)
- # ldnclj (14)
- # onyx (2)
- # reading-clojure (4)
- # reagent (28)
So, I just noticed that there is a defn and defn-
but def
does not have a matching def-
, but there is (def ^:private
@akiva: would it be possible to have a macro for def-
that just added the :private true
metadata?
Sure, you could but why would you want to? Only reason I can see why is to achieve symmetry between the two calls.
I think it’s just syntactic sugar. We tend to define functions far more often than we define global private vars.
@meow: this was discussed on the mailing list a few times already. Yes, defn- is there, but actually it shouldn't according to today's opinions of the maintainers of clojure.core.
" it pollutes the language core to provide convenience APIs that are combinatorial in nature." ..... "I would rather see defn- removed, than add any more foo- functions. If there are any more function "attributes" we want to tag things with (say, automatically memoized?) that would be 2^N new "convenient" definition forms, in an already-packed clojure.core namespace. And it's not hard at all to (let [foo-const 1] (defn foofn [x] ...) (defn more-foo [y z] ...)), or use ^:private if you really want a private global. "
@andrew: and @ska: cool, thanks. I was just curious if there was some technical reason that I wasn't getting. I completely understand not wanting to pollute a namespace.
@alejandro: thanks. I should be less shy about looking at the source