Fork me on GitHub
#clojure-spec
<
2021-03-02
>
mpenet15:03:30

``````(defrecord Foo [])
(s/valid? (s/coll-of any?) (Foo.))
boom - Can't create empty: user.Foo``````

😎 3
mpenet15:03:26

seems like a bug

Alex Miller (Clojure team)15:03:32

it is, we have a ticket for it

mpenet15:03:39

you can avoid it using `:into coll?`

Alex Miller (Clojure team)15:03:47

it's one of those things that seems obvious but is way more subtle than it seems in the impl.

Alex Miller (Clojure team)15:03:54

yeah, it's a dupe of that

mpenet16:03:47

would setting a default for :into at coll-of level to coll? be bad (I mean in the impl itself)?

mpenet16:03:17

I get the fact that every-impl is shared quite a bit so that can't be baked in at this level

Alex Miller (Clojure team)17:03:13

very hard to say without a lot of thinking

Alex Miller (Clojure team)17:03:36

and I rewrote half of that stuff in spec 2