This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2024-06-28
Channels
- # announcements (1)
- # beginners (128)
- # calva (15)
- # cider (1)
- # clerk (4)
- # clj-kondo (10)
- # clojure-berlin (5)
- # clojure-denmark (2)
- # clojure-europe (59)
- # clojure-nl (2)
- # clojure-norway (83)
- # clojure-sweden (3)
- # clojure-uk (4)
- # cursive (11)
- # datomic (8)
- # emacs (13)
- # events (1)
- # hyperfiddle (3)
- # juxt (2)
- # malli (13)
- # nrepl (10)
- # off-topic (46)
- # releases (2)
- # reveal (1)
- # rewrite-clj (6)
- # sci (6)
- # scittle (17)
- # shadow-cljs (2)
- # xtdb (2)
- # yamlscript (8)
good morning, what a lovely bright day
Do you put trailing question marks on keywords that map to true/false?
1๏ธโฃ - no question mark - :browse true
โ - question mark - :browse? true
2, though I've seen 1 argued by people I respect and I'm willing to be persuaded
Although there isn't necessarily a relationship between them, I'd say that ?
especially makes sense if your Clojure flavor of choice involves asserting that :foo?
is a boolean (and not just truthy/falsey), with Spec/Malli
Any idea what the arguments for no question mark is? I presume one situation could be if one decides later that a true/false value should have multiple truthy values. But in that case one could also introduce a different attribute without the question mark.
@U04V15CAJ once convinced me to drop the question mark, but I forgot why ๐
clj core also doesn't use question marks on keywords, e.g. not :macro? true
but :macro true
bingo
another argument is that instead of booleans you may want to use other values as well
> I also just find it very ugly to use question marks on keywords. i find everything else at least mildly convincing. not this ๐
sure, just wanted to vent my opinion for once which I usually oppress several times a week
I thought I'd read borkdude code without question marks - I even thought I'd found commits removing the question marks. But when I went looking today, I found more question marks: https://github.com/borkdude/carve/blob/e02b65f9de679450176a3fa26c89ffd5600d7eb8/test/carve/main_test.clj#L43
@U3X7174KS I distinguish between public API and internal. Interally I'm not consistent with this
> another argument is that instead of booleans you may want to use other values as well
That's precisely how ?
can shine - if there's a ?
I know it's a boolean, if not, I'll check doc/specs to see if it's some composite type
(of couse, if the convention is not followed, then it's useless)
the reverse is that you're just locking up your public API too tightly, I've seen several times that :browse true
becomes :browse :always
or :browse (fn [...])
Right, keeping the public api extensible (unknown number of consumers, prefer compatible changes) makes sense.
anyway I think it's already a lost battle since most people slap question marks on anything nowadays
> the reverse is that you're just locking up your public API too tightly, I've seen several times that :browse true
becomes :browse :always
or :browse (fn [...])
Yeah it relates to the flavor of Clojure you may want to foster
Most times I enjoy a tight flavor, where changes are conveyed through a new name for instance
But that's certainly just my preference
"question marks originally were just used for predicate functions" seems like the most notable thing that was lost?
yes. also consider that in the rest of the world, almost nobody uses question marks in config files (JSON etc). It seems it's gotten out of hand in our little bubble ;)
reminds me of the discussion around namespaced keywords interfacing with JSON
@U05092LD5 exactly, the underscore thing
Right, a single question mark on a key is going to make that data weird to use from Javascript, not config.browse
, but config["browse?"]
. Or Go or Java or Kotlin or Haskell or Elm.
I have used ?
on keywords and recently coming back to old code it did confuse me for a few seconds.
โA boolean is just an enum waiting to happenโ - Zach Tellman (I believe)
(I listened to a podcast about Hedy recently and I learned Hedy has localization so people can program in their own native language)
so just like Excel then? @U04V15CAJ
I love how silly questions like "do you put question marks on keywords?" can lead to interesting design discussions ๐
It felt like kind of a silly question when I asked it. At least it felt a bit silly. I mean, who cares about that question mark?
wtf, the weather forecast for the Germany-Denmark football match mentions possible tornado ๐ช๏ธ๐ฑ

And I got another test working for my MQTT broker.... Friday afternoon achievement!! (Took only a week or so)
Good morning! Gratuitous promotional cross post! https://gaiwan.co/blog/announcing-first-speakers/