clojure-spec

About: http://clojure.org/about/spec Guide: http://clojure.org/guides/spec API: https://clojure.github.io/spec.alpha/clojure.spec.alpha-api.html
mpenet 2021-03-02T15:45:30.097600Z

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

😎 1
mpenet 2021-03-02T15:46:26.098200Z

seems like a bug

alexmiller 2021-03-02T15:46:32.098500Z

it is, we have a ticket for it

mpenet 2021-03-02T15:46:39.098800Z

you can avoid it using :into coll?

mpenet 2021-03-02T15:46:41.099Z

ok

alexmiller 2021-03-02T15:47:47.099900Z

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

alexmiller 2021-03-02T15:48:09.100200Z

https://clojure.atlassian.net/browse/CLJ-2481

mpenet 2021-03-02T15:48:39.100400Z

related too https://clojure.atlassian.net/browse/CLJ-1975

alexmiller 2021-03-02T15:48:54.100700Z

yeah, it's a dupe of that

mpenet 2021-03-02T16:09:47.105200Z

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

mpenet 2021-03-02T16:10:17.105700Z

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

mpenet 2021-03-02T16:11:32.106200Z

like here https://github.com/clojure/spec.alpha/blob/master/src/main/clojure/clojure/spec/alpha.clj#L592 , I guess because "performance"

alexmiller 2021-03-02T17:39:13.107Z

very hard to say without a lot of thinking

alexmiller 2021-03-02T17:39:36.107200Z

and I rewrote half of that stuff in spec 2