splint icon indicating copy to clipboard operation
splint copied to clipboard

Rule: Suggest protocols over multimethods that use `type` or `class`

Open NoahTheDuke opened this issue 1 year ago • 0 comments

From clojure.pprint:

(defmulti 
  simple-dispatch
  "The pretty print dispatch function for simple data structure format."
  {:added "1.2" :arglists '[[object]]} 
  class)

Code like this should be written with protocols. There are reasons to stick with multimethods but as both a performance nit and a "best tool for the job" nit, protocols are preferred.

NoahTheDuke avatar Aug 20 '24 15:08 NoahTheDuke