This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-06-09
Channels
- # babashka (63)
- # beginners (97)
- # biff (11)
- # chlorine-clover (5)
- # cider (46)
- # clara (2)
- # clj-kondo (34)
- # clojure (65)
- # clojure-austin (1)
- # clojure-europe (9)
- # clojure-france (10)
- # clojure-italy (11)
- # clojure-nl (3)
- # clojure-spec (29)
- # clojure-uk (5)
- # clojuredesign-podcast (1)
- # clojurescript (56)
- # clr (6)
- # component (17)
- # conjure (5)
- # core-typed (5)
- # cursive (23)
- # data-science (5)
- # datahike (3)
- # dirac (3)
- # emacs (20)
- # fulcro (17)
- # graalvm (10)
- # graphql (8)
- # helix (99)
- # honeysql (7)
- # jobs-discuss (9)
- # juxt (9)
- # leiningen (14)
- # malli (3)
- # meander (6)
- # off-topic (77)
- # pathom (7)
- # re-frame (12)
- # reagent (8)
- # reitit (10)
- # restql (1)
- # shadow-cljs (22)
- # spacemacs (10)
I was reading this https://clojuredocs.org/clojure.core/keyword#example-542692d3c026201cdc326fde and had a thought to test this out, and seems clj-kondo doesn’t warn about these non-conformant keywords. Should it/could it?
@suomi.esko can you give a concrete example that doesn't require me to read this entire page?
Hmm, the anchor link doesn’t work for you? There’s a list of non-conformant keywords, eg. (keyword "abc def")
(keyword "")
(keyword "...")
and one I’ve actually seen in production, (keyword ":a")
the link works, but I don't have time to read all this, so if you can condense your question that would be helpful.
clj-kondo can check those kinds of things, but in general the argument to keyword
are runtime values, not literal strings - this is something which clj-kondo cannot check
That’s the could/should part. I’m not really sure why Clojure hasn’t natively spec’d that part, since it’s quite easy to make all kinds of mangled garble with the keyword
function.
this topic has come up often in the #clojure channel. I think one of the problems with narrowing down the possible keys is that it would break existing code which clojure will never do
you can always write your own my-keyword
function that checks things. one other reason is performance. creating keywords should be very fast in clojure. additional checks will mean a performance penalty
@U09LZR36F in which context do you mean valid? is anything invalid right now?
I guess what I really mean is that Alex has hinted that (keyword "foo bar")
will eventually print in such a way that it can be (read-string)
https://clojurians.zulipchat.com/#narrow/stream/180378-slack-archive/topic/clojure-dev/near/182433674 this was a good conversation
https://clojurians.zulipchat.com/#narrow/stream/180378-slack-archive/topic/clojure-dev/near/182434173 I guess this one is your tease
https://clojurians.zulipchat.com/#narrow/stream/180378-slack-archive/topic/clojure/near/177714921AHA! I was right
@U04V15CAJ fwiw, I think the specific typo of (keyword ":ANYTHING")
might be worth catching
I’m willing to bet that pipe surrounded form will break backwards compatibility even worse though… 🙂