Fork me on GitHub

@alexmiller cool. yeah, I’m not saying there isn’t ways to hook things up. For manual use, which obviously is the major use case, things have felt natural and I haven’t had to read source etc. For manipulating specs programatically I’m convinced all I want is doable, but it hasn’t felt “natural” and I’ve had to read the implementation to try to grok the explicate/spec/spec* machinery. The map syntax you hint at looks likely to be more intuitive to me, so I like that. Thanks for both helping me across my stumbling block and for keeping on improving spec!


What are the current workarounds for closed spec-like behaviour? I’m trying to retrofit specs to some existing code, and I’d like to ensure that I haven’t missed any cases during development.


In particular, how can I specify a map that should only have the keys I’ve specified?


Awesome, thanks!


Also, I’d like to spec a map which has some standard keyword keys, but also might have string keys with values specified by a spec. Can I do that? Neither s/keys nor s/map-of seem to fit that.

Alex Miller (Clojure team)23:08:52

You can, but not easily. You can do an s/coll-of :kind map? and then spec the possible mapentry types

Alex Miller (Clojure team)23:08:16

Another path (if you care less about gen) is to use a conformer to keywordize the map then s/keys


Yeah, I don’t care about gen in this case.


Just trying to spec an existing system.