Welcome! Please see the About page for a little more info on how this works.

+1 vote
in Clojure by
retagged by

Many macros in clojure have a spec which get executed by the compiler at macro-expansion time.

At this time extend-protocol doesn't have such a spec.
I'd like to know if extend-protocol is supposed to work with (Class/forName ..) or that the class name to which the protocol is extended must always be a symbol. A spec would be the natural place to get this answer from. extend-protocol is known to not work with Class/forName when you provide more than one:

(extend-protocol IFoo (Class/forName "[B") (Class/forName "[D")) Syntax error (IllegalArgumentException) compiling at (REPL:1:1). Don't know how to create ISeq from: java.lang.Character

If the spec says anything about this, I can also make linting for this in clj-kondo. At this time it seems to be ambiguous: (extend-protocol IFoo (Class/forName "[B")) does work.

Related issue: https://clojure.atlassian.net/browse/CLJ-1381

1 Answer

+1 vote