This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-05-23
Channels
- # aleph (9)
- # beginners (30)
- # boot (42)
- # carry (1)
- # cider (148)
- # clara (2)
- # cljsrn (13)
- # clojars (2)
- # clojure (90)
- # clojure-dev (1)
- # clojure-dusseldorf (2)
- # clojure-italy (7)
- # clojure-madison (1)
- # clojure-quebec (1)
- # clojure-russia (19)
- # clojure-sg (1)
- # clojure-spec (14)
- # clojure-uk (90)
- # clojurebridge (1)
- # clojurescript (70)
- # clr (7)
- # core-async (24)
- # cursive (26)
- # data-science (2)
- # datascript (3)
- # datomic (46)
- # devops (2)
- # emacs (6)
- # events (1)
- # figwheel (2)
- # hoplon (200)
- # klipse (2)
- # ldnclj (1)
- # lein-figwheel (4)
- # leiningen (3)
- # off-topic (44)
- # om (70)
- # other-languages (6)
- # pedestal (5)
- # protorepl (1)
- # re-frame (17)
- # reagent (14)
- # schema (2)
- # spacemacs (1)
- # specter (3)
- # test-check (38)
- # unrepl (38)
- # untangled (19)
- # yada (16)
What is the right way to spec functions that can throw exceptions? It seems like I need to allow :ret
to be nil
to handle exceptions here
If there is an exception there is no return value
Exceptions are not covered by spec
Because they are ... exceptional cases
you’ll need to explain more, not sure what you mean
Is this expected?
(let [n 2
t int?]
(s/conform (s/coll-of t :into [] :kind vector? :count n) [1 2]))
=> [1 2]
(let [n nil
t int?]
(s/conform (s/coll-of t :into [] :kind vector? :count n) [1 2]))
=> :clojure.spec.alpha/invalid
(let [t int?]
(s/conform (s/coll-of t :into [] :kind vector? :count nil) [1 2]))
=> [1 2]
I guess this line is responsible. https://github.com/clojure/spec.alpha/blob/master/src/main/clojure/clojure/spec/alpha.clj#L541
I just wonder if this is a bug, or if the s/every
macro is meant to check the 'n
symbol rather than what it evals to.
I think I’d call it a bug, given the docstring states that nil is the default which seems to imply you could pass it
feel free to file a jira
Ok, will do. Thanks