NoahTheDuke / splint

A Clojure linter focused on style and code shape.
https://cljdoc.org/d/io.github.noahtheduke/splint/
Mozilla Public License 2.0
115 stars 2 forks source link

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

Open NoahTheDuke opened 2 months ago

NoahTheDuke commented 2 months ago

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.