On Tuesday, February 27, 2018 at 1:13:52 PM UTC-6, Leon Grapenthin wrote: > > I'm sure you'd all use def- if it existed. Even if you could just type the > much simplified ^:private, use an editor snippet, refer your own macro, or > create a whole new namespace for it. You'd do none of that. You'd totally > fall for the trap and type def-, the syntactic aid that should not be there. >
I'm sure I would. But I don't need it. If it was there, we'd be having the same discussion about defmacro- or defmulti- or whatever. There has to be a line somewhere, we drew before def-. > There is "regret over even adding defn-"? You used defn- just recently in > the tools.deps.alpha core namespace 9 times. Rich used it in clojure.spec > core namespace 46 times. :))) > Sure, it's there. But if it wasn't, I'd use ^:private and never worry about it. > Jokes aside, if Rich simply doesn't want it that's fine of course - it's > his language. However if people ask me again I will just say that instead. > Believe it or not, I got this question three times last year and the "copy > N things" argument failed 3/3. > Why even make the argument? If you want def- in your code, then add it. It's a Lisp - we can all have the language we want. The impl ns pattern recommended by Timothy is truly a very good one that I > apply a lot myself, especially in larger projects and when "private" macro > helpers are involved (and probably the only solid workaround recommended > here because it has value in itself). > I use this one as well (I haven't doc'ed it all yet because I'm still fighting with autodoc) but I consider parts of tools.deps.alpha public and parts to be "impl". > How much do I def things? - I haven't done the computation but I'm pretty > sure that I def more things ^:private than I def things public. Little > lookup tables etc.. Also I'd argue that def is the second most used top > level form after defn. If not, the ones that come before don't have > ^:private semantics. Well, if there was any chance for def- left I'd do a > statistic over available codebases - let me know. > Here's a quick and dirty stat based on the set of ~375 projects I have at hand: [~/code]$ ack -c -h --clojure "\(defn- " */src 5106 [~/code]$ ack -c -h --clojure "\(defn " */src 14344 [~/code]$ ack -c -h --clojure "\(def " */src 3924 [~/code]$ ack -c -h --clojure "\(def \^:private" */src 559 # note this is a subset of prior, first pair are disjoint defn is 5x more common than def. About 14% of def's are private and 26% of defns are private. On average I have <2 private defs per project. That doesn't do much to convince me it's a priority. -- 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.