依赖于 every-impl 的规范(例如 every、coll-of 等)在传递一个记录时可能会崩溃。例如
{code:title=REPL 会话|borderStyle=solid}
> (require ['clojure.spec.alpha :as 's])
> (s/def ::coll-any (s/coll-of any?))
> (defrecord Pair [first second])
> (s/valid? ::coll-any 3)
false
> (s/valid? ::coll-any {:a 1 :b 2})
true
> (s/valid? ::coll-any (Pair. 1 2))
执行错误(UnsupportedOperationException)在用户.Pair/empty (REPL:1)。
无法创建空:用户.Pair