Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
NoahTheDuke opened this issue Aug 20, 2024 · 0 comments
Open
Labels
rule-idea A suggestion for a new rule

Comments

@NoahTheDuke
Copy link
Owner

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 NoahTheDuke added the rule-idea A suggestion for a new rule label Aug 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rule-idea A suggestion for a new rule
Projects
None yet
Development

No branches or pull requests

1 participant