This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-03-19
Channels
- # announcements (52)
- # asami (83)
- # atom-editor (1)
- # babashka (143)
- # beginners (123)
- # calva (18)
- # chlorine-clover (21)
- # cider (7)
- # clj-kondo (57)
- # cljs-dev (4)
- # clojure (209)
- # clojure-boston (1)
- # clojure-europe (27)
- # clojure-germany (12)
- # clojure-italy (17)
- # clojure-nl (3)
- # clojure-serbia (6)
- # clojure-spec (1)
- # clojure-uk (59)
- # clojurescript (82)
- # conjure (9)
- # core-async (6)
- # cursive (20)
- # data-science (1)
- # datahike (1)
- # datascript (1)
- # datomic (86)
- # duct (5)
- # emacs (6)
- # events (6)
- # figwheel-main (4)
- # fulcro (27)
- # graalvm (19)
- # leiningen (14)
- # lsp (30)
- # malli (48)
- # meander (3)
- # off-topic (6)
- # pedestal (2)
- # practicalli (1)
- # rewrite-clj (21)
- # shadow-cljs (18)
- # sql (15)
- # tools-deps (9)
- # vim (3)
- # wasm (3)
- # xtdb (18)
Hey there -- I really like this idea of closing specs at check-time in spec 2. Will there be (or is there already) a way to apply the same idea to sequential specs? Let's say I'm speccing hiccup as
(defmulti form-of first)
(defmethod form-of :default [_]
(s/cat :tag keyword?
:props (s/? map?)
:children (s/* ::node)))
(s/def ::component (s/multi-spec form-of (fn [val _tag] val)))
(s/def ::node
(s/or :component (s/and vector? ::component)
:list (s/coll-of ::node
:kind (every-pred sequential?
(complement vector?)))
:atom (complement coll?)))
and define a bunch of components like
(defmethod form-of :script [_]
(s/cat :tag #{:script}
:props (s/? map?)
:children (s/* string?)))
Could I later restrict ::component
somehow to reject [:script ...]
as part of the instruction to s/valid?
? Or could my defmethod
s check a dynamic binding, say *illegal-tags*
?