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.
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. :))) 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. 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). 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. On Tuesday, February 27, 2018 at 2:41:15 AM UTC+1, Alex Miller wrote: > > We're not going to add def-. There is regret over even adding defn-, but > we don't take things away... > > At one point all of the current metadata niceties didn't exist (used to be > #^{:private true} some may recall) and defn- seemed worth doing I presume > (pre-dates my involvementT). But then that was all simplified down to just > ^:private and it's preferred to compose the pieces rather than copy N > things. > > There used to be a slew of these in the old clojure-contrib ( > https://github.com/clojure/clojure-contrib/blob/master/modules/def/src/main/clojure/clojure/contrib/def.clj > > - but no def- !). > > How often do you def things anyway (much less private things)? > > On Monday, February 26, 2018 at 1:50:40 PM UTC-6, Leon Grapenthin 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 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.