cursive icon indicating copy to clipboard operation
cursive copied to clipboard

Refactoring: changing protocol method name changes only its call sites, not implementations

Open rlewczuk opened this issue 11 years ago • 5 comments

In this example:

(ns bromba.core)

(defprotocol FooBar
  (foo [o]))

(extend-type String
  FooBar
  (foo [o] (count o)))

(extend Long
  FooBar
  {:foo (fn [i] i)})

(defn boom []
  [(foo "asd") (foo 42)])

Renaming foo method will only change its call sites but names in either extend-type or extend will remain intact.

rlewczuk avatar Jan 06 '14 11:01 rlewczuk

Yes, unfortunately not all the symbol resolution for protocols is there yet. This should be coming soon, however.

cursive-ghost avatar Jan 06 '14 11:01 cursive-ghost

Note to self - this should also apply to interface methods implemented in reify/deftype/defrecord forms.

cursive-ghost avatar May 20 '14 03:05 cursive-ghost

Even though it's digging up super old issues this is a fundamental Clojure language feature that's actually used more than by then. Is there hope that proper find usages/implementations? Maybe not soon but ever...

katox avatar Jul 24 '25 10:07 katox

Second this, all my codebase is based on protocols and issues like this and #2930 are a daily annoyance.

metametadata avatar Jul 24 '25 11:07 metametadata

My apologies this has taken so long, it will definitely be ever and also hopefully soon, I've been working on some internal changes needed for this and related things (doing the same for multi methods) so it is on the way.

cmf avatar Jul 24 '25 19:07 cmf