This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-04-15
Channels
- # announcements (3)
- # architecture (1)
- # babashka (52)
- # beginners (228)
- # calva (1)
- # chlorine-clover (31)
- # cider (9)
- # clj-kondo (16)
- # cljs-dev (25)
- # cljsrn (21)
- # clojure (116)
- # clojure-argentina (8)
- # clojure-europe (18)
- # clojure-france (17)
- # clojure-germany (1)
- # clojure-nl (5)
- # clojure-spec (49)
- # clojure-uk (63)
- # clojurescript (59)
- # community-development (14)
- # conjure (89)
- # core-matrix (1)
- # cursive (18)
- # data-science (1)
- # datomic (27)
- # exercism (4)
- # figwheel-main (5)
- # fulcro (38)
- # ghostwheel (8)
- # graalvm (5)
- # hoplon (2)
- # jobs-discuss (17)
- # juxt (1)
- # lambdaisland (5)
- # luminus (1)
- # lumo (9)
- # malli (7)
- # off-topic (32)
- # planck (24)
- # re-frame (14)
- # reagent (14)
- # reitit (14)
- # rum (23)
- # shadow-cljs (80)
- # spacemacs (2)
- # sql (6)
- # unrepl (1)
- # xtdb (2)
@borkdude thought you'd appreciate this quote from a classic paper on incremental parsing
So Malli showed a pretty nifty sneak peek of clj-kondo integration, where you could define the inputs and outputs of a defn
and kondo could somehow lint their usage. Is that something that kondo can do today? And if yes, do the types “flow” down to functions calls etc?
@orestis They are using the format described here: https://github.com/borkdude/clj-kondo/blob/master/doc/types.md
My use case is, I have some functions whose arguments can be described pretty tightly (they are GraphQL objects). I’d like to be able to catch mistypes, checking for keys that aren’t there (closed types) etc. Doing it at the syntax level like demonstrated would be cool, but I could also do it on my own.
Some example:
(defn my-resolver [context args _]
(let [subtype (:foo args)]
(deal-with-subtype context subtype (:bar args))))
@orestis there is this now: {:op :keys, :req {:a :string} :opt {:b :int}}
, but that's mostly for checking map literals at callsites
not sure how well that works with "flow", I expect it not to work at all at the moment.
Can I somehow “lint” that :foo
is actually part of some spec? Can I somehow lint that the third argument deal-with-subtype
( (:bar args)
) is a sub-spec of the bigger spec?
I have currently one function in clj-kondo that is typed using the :keys
:
https://github.com/borkdude/clj-kondo/blob/master/src/clj_kondo/impl/findings.types.edn
No, there is no spec-like thing