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

Suggest extend over extend-type/extend-protocol when bad :tag metadata would be emitted #401

Open
vemv opened this issue Jun 24, 2021 · 0 comments

Comments

@vemv
Copy link
Collaborator

vemv commented Jun 24, 2021

From what I learned from https://ask.clojure.org/index.php/10716/is-tag-metadata-that-represents-function-calls-useful?show=10721#c10721 , the c035804 commit is kind of wrong because while the targeted extend-protocol call does work as intended, the :tag metadata it will be emit will be wrong.

OTOH the old behavior of simply failing with :wrong-tag was opaque because it said something was wrong, while it was a functional pattern and no actionable advice was printed.

So, I'm thinking to revert c035804 , and instead when (-> tag first #{'class 'clojure.core/class 'Class/forName 'java.lang.Class/forName}) is detected, the linter message explictitly says:

please use clojure.core/extend instead of %s for dynamically-calculated class names, otherwise the emitted :tag metadata will be wrong.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant