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
mg 2021-01-13T16:32:36.044700Z

It appears that closed spec checking doesn't work on select in spec2. Is this something deliberate?

alexmiller 2021-01-13T16:35:10.045300Z

don't remember :) I think it should work? but could easily be buggy

mg 2021-01-13T16:37:50.045800Z

Toy example:

(spec/def ::a string?)

(spec/def ::s (spec/schema [::a]))

(spec/valid? ::s {::a "hello" ::b "world"} {:closed #{::s}}) ;; => false

(spec/valid? (spec/select ::s [*]) {::a "hello" ::b "world"} {:closed #{::s}}) ;; => true

mg 2021-01-13T16:38:15.046400Z

I read through the implementation of select and it looks like it doesn't do anything with :closed

alexmiller 2021-01-13T16:42:29.046700Z

the things you "close" are schemas

alexmiller 2021-01-13T16:43:04.047300Z

select has some pending rework to make it build more on top of schema

alexmiller 2021-01-13T16:43:19.047600Z

when that's done it should start getting that effect

alexmiller 2021-01-13T16:44:44.048100Z

so without thinking more, this is probably in the category of wip

mg 2021-01-13T16:47:37.049Z

Ok, thanks for the clarification! Sounds also like it would not be fruitful for me to submit a patch, also, so I'll wait on it

alexmiller 2021-01-13T16:49:23.049400Z

nah, it's a non-trivial amount of work and bound into other things