Hi all,

On several occasions, Alex Miller has emphasized that we should be wary of
“baking in” conformers when defining specs. I agree with him, but it’s not
clear to me how to “opt in” to using conformers on map vals. As far as I
can tell, I’m either limited to using unqualified keys —which enables
swapping specs from alternative namespaces for a given map-entry— or
adapting any conformer to operate on the whole map (e.g., with update)
rather than the val of a map-entry directly.

So, some questions:

   1. Am I missing something? Is there actually a way to specify
   conformance *à la carte* for the vals of a map with qualified keys? If
   not…
   2. Is there a plan to add this functionality? (I would be happy to
   create a JIRA issue if it would be better to take this conversation there.)
   If not…
   3. Is this seen as an acceptable tradeoff of an API that the core
   Clojure devs are otherwise happy with? Or is it in fact a
*deliberate* limitation,
   in line with the “map specs should be of keysets only”
   <http://clojure.org/about/spec#_map_specs_should_be_of_keysets_only>
   design decision?

Thank you,
Josh

P.S. To confirm my understanding that there is not a way to specify
conformance inline, I attempted to create and use a spec defined like (s/keys
:req [(s/and ::foo (s/conformer ,,,))]). To my surprise, clojure.spec used
it without complaint, although the behavior of s/conform was unaffected.
Should I create a JIRA issue for this?

P.P.S. A previous draft of this email had detailed illustrative examples,
cut out of fear of being tiresomely long-winded. If anything I described
isn’t clear, let me know and I’ll go ahead and include the examples in the
conversation.

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to