Hi there, our code base have embraced extend-with-metadata
protocols since its introduction - we like to have map components rather than records.
However, the code base and team are big clojure spec users and we were expecting the last form of the following to throw:
(ns defproto-spec.test
(:require [clojure.spec.alpha :as s]
[clojure.spec.test.alpha :as st]))
(defprotocol SpecTest
:extend-via-metadata true
(delete [impl id]))
(s/fdef delete-impl
:args (s/cat :impl any? :id string?))
(defn delete-impl [_ id]
(println (str "This deletes " id))
id)
(def impl (with-meta {} {`delete delete-impl}))
(st/instrument)
(delete impl 1) ;; should throw but it doesn't
Why were we expecting it to work?
Maybe because the feature is newer (1.10) and because of the following:
defproto-spec.test> (st/instrument)
[defproto-spec.test/delete-me defproto-spec.test/delete-impl]
Unfortunately that's not that case. I would be willing to work on a patch/document this if is not already in someone else's pipeline.
Thanks,
Andrea.