Clojure

Protocol implementation inconsistencies

Details

  • Type: Defect Defect
  • Status: Open Open
  • Priority: Major Major
  • Resolution: Unresolved
  • Affects Version/s: Release 1.2, Release 1.3
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None
  • Environment:
    All

Description

There seems to be some inconsistencies when implementing protocols that have multi arity functions depending on how the protocol is implemented. I have attached a clj file illustrating this. The short version is that multi arity must be defined as such w/ defrecord:

(defrecord Zomg []
SomeProto
(hello [_] 1)
(hello [_ _] 1))

And as such with extend-type

(extend-type Object
SomeProto
(hello
([_] 1)
([_ _] 1)))

I have only tested defrecord & extend-type. I am unsure how it works with deftype and extend-protocol.

Activity

People

Vote (3)
Watch (3)

Dates

  • Created:
    Updated: