Clojure

satisfies? doesn't work with the new instance-based protocol polymorphism

Details

  • Type: Defect Defect
  • Status: Open Open
  • Priority: Major Major
  • Resolution: Unresolved
  • Affects Version/s: Release 1.10
  • Fix Version/s: None
  • Component/s: None
  • Labels:
  • Patch:
    Code
  • Approval:
    Triaged

Description

I'd expect that `satisfies?` works even when providing protocol implementation via metadata, however that doesn't seem to be the case:

(defprotocol Foo :extend-via-metadata true (foo [x]))
(foo (with-meta [42] {`foo (fn [x] :boo)}))
;; => :boo

;; but `satisfies?` doesn't work
(satisfies? Foo (with-meta [42] {`foo (fn [x] :boo)}))
;; => false

Patch: 0001-CLJ-2426-fix-satisfies-for-new-instance-based-protoc.patch

Activity

Hide
Alex Miller added a comment -

Would it be better to put the metadata check second instead of first for perf? Or is it actually faster?

Show
Alex Miller added a comment - Would it be better to put the metadata check second instead of first for perf? Or is it actually faster?

People

Vote (4)
Watch (5)

Dates

  • Created:
    Updated: