Personally, I just don't use private defs at all. Inevitably, you'll have to var-hack them during testing, so at some point I stopped doing so.
Interesting. I pretty much never write a private function these days so I use defn but not defn- however, nearly all of my def’s are ^:private except in tests (where it’s just laziness – they could all be private) or examples (which are, again, often mostly laziness). So def- would save me a lot of typing and I’d even be happy if the default was private for def (and needed some ^:public metadata to override). But I know neither of those will happen so I just try to make it muscle-memory to always type ^:private after I type def! 😊 Sean Corfield -- (970) FOR-SEAN -- (904) 302-SEAN An Architect's View -- http://corfield.org/ "If you're not annoying somebody, you're not really alive." -- Margaret Atwood ________________________________ From: clojure@googlegroups.com <clojure@googlegroups.com> on behalf of Gary Trakhman <gary.trakh...@gmail.com> Sent: Monday, February 26, 2018 12:03:27 PM To: clojure@googlegroups.com Subject: Re: Why does the `def-` not exist? If you're an emacs user, have you considered Yasnippet? It shouldn't be too hard to add to this: https://github.com/mpenet/clojure-snippets/tree/master/snippets/clojure-mode . Personally, I just don't use private defs at all. Inevitably, you'll have to var-hack them during testing, so at some point I stopped doing so. On Mon, Feb 26, 2018 at 2:50 PM Leon Grapenthin <grapenthinl...@gmail.com<mailto:grapenthinl...@gmail.com>> wrote: I have written enough Clojure so that I can assure you that every few days when I type ^:private again I am still annoyed by it. Not every time, but probably every second or third time. Its just in the way of the prototyping typing (micro-)flow. SHIFT-6 you don't hit so often so you have to hit it right. On german keyboards, by the way, ^ is a much more annoying character to type. Then a colon, did I miss the colon? What did I want to do again? When prototyping an API ns its important to distinguish what is private and what isn't. If only I could just write def- without any overhead. First world aka best language problems, I know... But whats left for an enthusiast except bikeshedding? We both know that a JIRA discussion on this will not happen due to a lack of importance. And unless somebody manages to convince Rich, this feature won't happen. Fair enough. I'd consider myself a power user since 1.5.1 and value its conservative governance above every other kind. The "lets not start postfixing lots of macros with -" argument a good one in general and probably was a good one at the time. But not in this case because defn and def are the two most used and most elementary top level forms. This argument didn't convince anyone who has asked me about this. The counter argument goes "I don't want the - postfix for anything else, just for def because I use it a lot" -rightfully so. The lack of def- is just unnecessary typing overhead in lots of cases. It could be removed at the cost 5m on a beautiful day. I'd appreciate it :) On Monday, February 26, 2018 at 6:52:51 PM UTC+1, Alexander Yakushev wrote: - Not that often. When I know for certain, I add ^:private. Not like it's much more work. If I didn't know ahead of time, I would forget to add the private flag in either case. - Never. - Can't recollect such an event. - A few times. As far as I can tell, people appreciate the metadata approach since it is unique and powerful. The lack of one particular non-critical syntactic sugar is never an issue. I won't mind having def- as much as I don't mind not having it. Pretty much the same as for defn- – Earth wouldn't stop turning if you had to type defn ^:private once in a while. And while I agree with you that it would be somewhat useful, bikeshedding only gets you so far. On Monday, February 26, 2018 at 7:17:05 PM UTC+2, Leon Grapenthin wrote: - How many times do you just write (def ...) instead of (def ^:private ...) because you are not sure whether you need the definition yet, want to save effort, and then you forget to add ^:private later? - How many times have you implemented def- yourself into your project and then used only half of the time because you had to require and :refer the thing from some util namespace which is just as annoying as typing ^:private? - How many times do you use autocomplete on some namespace and find internals because their dev forgot ^:private? - How many times in a year do you have to explain to a Clojure newbie that there is defn- but no def-? IME the statistic strongly supports def- - and I don't see why it would hurt. Having def- in clojure.core will not magically result in having defmacro- and defmulti- and xyz-. Its a false and the only counterargument I have seen. It would be very useful, though. On Monday, February 26, 2018 at 1:44:27 PM UTC+1, Alexander Yakushev wrote: Usually, it is better to use metadata rather than create an exponential explosion of names. Public/private is just one dimension, but you also have static/non-static, dynamic/non-dynamic, etc. Then you have functions, vars, macros, perhaps modified functions (like schema.core/defn). Cartesian product of those would be huge. defn- is an exclusion from the rule probably because it is used more often than others. On Monday, February 26, 2018 at 10:58:43 AM UTC+2, Promise. wrote: `defn-` => `defn` 'def-` => `def` -- 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<mailto: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<mailto:clojure%2bunsubscr...@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<mailto:clojure+unsubscr...@googlegroups.com>. For more options, visit https://groups.google.com/d/optout. -- 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<mailto:clojure+unsubscr...@googlegroups.com>. For more options, visit https://groups.google.com/d/optout. -- 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.