Why aren't specs pure data?

Spec forms are data. They are lists of symbols, keywords, etc. Most of the api ops take spec names or spec forms and return data (conform returns data, explain-data returns data, etc).

Spec 2 is a bit more rigorous about enforcing the symbolic nature of predicate references so is even better in that regard. It also has a (still in work) map form of all specs and conversions between them.

The macros (in spec 2) are helpful expanders to more fully resolved symbolic spces, but you can use spec 2 without touching any macros at all if you desire.

So, in short I disagree with the premise of your question. Spec forms are data, and can be sent across the wire. Spec maps are a second format, more amenable to transformation.

To the question of why there are spec objects under the hood, the answer is performance. The spec objects compile in predicates and other things to make validation faster.

5 Likes