Sometimes, there are relationships between different parts of data that 
need to be included in the spec.
This can surely be done using "s/and" and a predicate but this way we lose 
granularity when it comes to
the output of "s/explain" – we'll only ever see _that_ something is wrong 
but never where exactly the
problem lies.

Specifically, one might be able to generate the spec for one part of the 
data from another. For example,
there could be a section of variable definitions, plus a different one 
where those variables are used, and
the second part could benefit from a specification restricting the value 
space for variable names. Which,
in turn could be generated from the first part.

Alternatively, this could be expressed as a specialisation of an existing 
spec, i.e. saying "The data conforms
to spec A and, additionally (!), every value within conforming to spec B 
also conforms to a third one, C."

(I also collected these thoughts in this 
Gist: https://gist.github.com/xsc/bd4c498dc516435c71d01b4fdd224e85)

Is this, at all, in line with the ideas behind spec? IMO, it could be a 
powerful tool – my target use case being
semantic validation of an AST where the AST's structure conforms to a spec 
bundled with the parser.

Cheers,
Yannick

-- 
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