Fork me on GitHub
#clojure-dev
<
2020-11-10
>
pyr07:11:47

I found it a bit odd that the 2-arity version of keyword fails on anything else than strings. Now that simple-symbol? and simple-keyword? exist to validate the input, could it relax its input requirement for these two cases? (Granted: this is a very minor oddity, just wondering for my own curiosity)

Alex Miller (Clojure team)13:11:06

Relax to support what? Symbols and keywords?

Alex Miller (Clojure team)13:11:22

Is there some example where this would be useful?

borkdude22:11:21

Is this a case of Hyrum's law or is this really supported on purpose? https://github.com/borkdude/sci/issues/440

borkdude22:11:46

I stumbled upon this in real code somewhere

bronsa22:11:15

I'm not sure, but as an extra datapoint, deftype ignores the namespace segment aswell, and I'm 100% sure somewhere in clojure.core there's code that emits deftypes with clojure.core namespacing (on interface method names)

bronsa22:11:52

ah yeah, it's defrecord

bronsa22:11:56

(e.g. it macroexpands to

(deftype* user/x user.x [...] :implements [... ] (clojure.core/entrySet [..] ...) ..)
)

bronsa22:11:58

so I can imagine real code out there that would break if this behavior was removed from deftype and or extend-type

bronsa22:11:24

likely a bunch of macros out there that don't do

~'method-name