This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-08-07
Channels
- # beginners (95)
- # cider (131)
- # cljdoc (12)
- # cljsjs (2)
- # clojure (209)
- # clojure-dev (1)
- # clojure-italy (3)
- # clojure-nl (10)
- # clojure-russia (37)
- # clojure-spec (19)
- # clojure-uk (182)
- # clojurescript (136)
- # cursive (28)
- # datomic (28)
- # editors (55)
- # figwheel-main (1)
- # fulcro (36)
- # hyperfiddle (12)
- # jobs (1)
- # jobs-discuss (55)
- # luminus (1)
- # mount (1)
- # off-topic (28)
- # onyx (18)
- # reagent (17)
- # ring-swagger (4)
- # rum (14)
- # shadow-cljs (22)
- # spacemacs (15)
- # tools-deps (16)
- # vim (26)
Is there a conventional way to describe a spec as an argument? Like if I have a function that takes a spec? I see s/spec?
- but that doesn’t seem to work with something like (s/spec? ::my-spec)
There is no single predicate for it right now
Probably an accident of implementation; A spec is put in a global registry atom, which contains a hashmap from key/symbol to spec objects. There's no clear place to put metadata like there is with vars.
@U09R86PA4 isn’t it possible to attach metadata to the keyword representing the spec?
(with-meta :mykw {:abc 123})
ClassCastException clojure.lang.Keyword cannot be cast to clojure.lang.IObj clojure.core/with-meta--5142 (core.clj:217)
it’s really unfortunate; being able to attach doc to specs in this way would be really neat
especially since the doc
function is already able to pull specs from the registry and show the predicate
I guess the implementation doesn’t really matter; it could be an extra global hashmap from keywords to strings
@alexmiller I found this but it hasn’t moved in a while: https://dev.clojure.org/jira/browse/CLJ-1965
It’s the most voted issue in jira and we are def on board with fixing it
But there are impl factors meaning it will be a while before it’s implemented