This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-09-22
Channels
- # aleph (6)
- # announcements (1)
- # babashka (2)
- # beginners (51)
- # calva (14)
- # cider (1)
- # clj-kondo (15)
- # cljs-dev (2)
- # cljsrn (1)
- # clojure (9)
- # clojure-czech (2)
- # clojure-spec (5)
- # clojure-uk (45)
- # clojuredesign-podcast (2)
- # clojurescript (4)
- # clojutre (3)
- # cursive (4)
- # datomic (8)
- # duct (8)
- # jackdaw (1)
- # joker (1)
- # keechma (1)
- # off-topic (127)
- # om (1)
- # reagent (1)
- # reitit (6)
- # shadow-cljs (22)
- # testing (3)
I'm seeing a couple of cases of type hints like this: https://github.com/clojure/data.json/blob/f1bf4e264749b51c64f4692da57eb89008758097/src/main/clojure/clojure/data/json.clj#L291
So s is a CharSequence (which could be nil, a string, a regex...) which is then used with count
. But count
doesn't work with regexes. Is there a reason why the type hint isn't just String then?
Same issue here: https://github.com/clojure/clojurescript/blob/0c353f1947089cb8b1f010b4294b94ac109d4ef6/src/main/clojure/cljs/compiler.cljc#L171
How can it be a regex? I don't think regex is a sub-class of CharSequence in Java, is it?
I'm not saying I know the type hint CharSequence is correct in this particular fn defn, but it seems like if it could be called with that arg being a regex, then the type hint is wrong.