This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
- # beginners (61)
- # boot (1)
- # cider (55)
- # cljs-dev (17)
- # cljsrn (1)
- # clojure (31)
- # clojure-india (5)
- # clojure-spec (9)
- # clojure-uk (42)
- # cursive (3)
- # datomic (29)
- # editors (3)
- # fulcro (23)
- # hoplon (2)
- # lumo (12)
- # off-topic (8)
- # pedestal (6)
- # re-frame (3)
- # reagent (8)
- # reitit (23)
- # shadow-cljs (82)
- # specter (14)
- # tools-deps (8)
case with keywords, but
lein check tells me that's probably not good:
>Performance warning, project/file.clj:69:7 - case has int tests, but tested expression is not primitive.
The code's like
Is there a way to resolve the warning or should I just ignore it? (It bugs me)
(case (:key-to-check my-map) :a (do-a) :b (do-b))
also, with a quick search of the lein code, it doesn't look like "Performance warning" is something lein check does, so my guess is you have some plugin that is adding that, and that plugin might be junk
user=> (set! *warn-on-reflection* true) true user=> (fn  (case (:foo 1) :a nil :b nil)) #object[user$eval147$fn__148 0x64ba3208 "[email protected]"] user=> (fn  (case (:foo 1) 1 nil 2 nil)) Performance warning, NO_SOURCE_PATH:3:8 - case has int tests, but tested expression is not primitive. #object[user$eval152$fn__153 0x71cf1b07 "[email protected]"] user=> (fn  (case (int (:foo 1)) 1 nil 2 nil)) #object[user$eval157$fn__158 0x3300f4fd "[email protected]"] user=>
it was a
case like this
(case status 200 (ok) 404 (not-found) (internal-server-error))
seems unlikely, are you sure it isn't because the compiler can't tell that status is an int?
case is often used for performance sensitive stuff, and has a fast path for certain kinds of things like if the text expression and all the cases are ints
Is there any no-configuration local database a-la Datomic? Ideally featuring the same API.
I think I can make something out of Datascript, but if someone already has done that then it'd be a waste of time.
@alexmiller Thanks, but I think I have a pretty good use case for actually doing that (unless by "that" you mean AOT). I am digging through JIRA tickets, but can't find one related to this issue. Should I open one?
I know I worked on this same problem for someone at Cognitect last year but I think ultimately it was easier to just restructure the code
I know the init methods are chunked up per 100 vars but there is someplace else in the init that it comes up
And yes, I did work around it — by splitting the namespace (by FontAwesome icon "style", the reason I needed so many defs is because these namespaces are auto-generated from FontAwesome's
icons.json). This should buy me some time until the library grows so much that I'll exceed the 3274 forms limit. So it isn't a complete showstopper, just an annoyance.
Hi everyone, I just released a very experimental message board, it's a web server written entirely in Clojure, check it out: http://practicalhuman.org