<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title>Clojure Q&amp;A - Recent questions tagged core.specs</title>
<link>https://ask.clojure.org/index.php/tag/core.specs</link>
<description></description>
<item>
<title>spec for extend-protocol</title>
<link>https://ask.clojure.org/index.php/13723/spec-for-extend-protocol</link>
<description>&lt;p&gt;Many macros in clojure have a spec which get executed by the compiler at macro-expansion time.&lt;/p&gt;
&lt;p&gt;At this time &lt;code&gt;extend-protocol&lt;/code&gt; doesn't have such a spec.&lt;br&gt;
I'd like to know if &lt;code&gt;extend-protocol&lt;/code&gt; is supposed to work with &lt;code&gt;(Class/forName ..)&lt;/code&gt; 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. &lt;code&gt;extend-protocol&lt;/code&gt; is known to not work with &lt;code&gt;Class/forName&lt;/code&gt; when you provide more than one:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;(extend-protocol IFoo (Class/forName &quot;[B&quot;) (Class/forName &quot;[D&quot;))
Syntax error (IllegalArgumentException) compiling at (REPL:1:1).
Don't know how to create ISeq from: java.lang.Character&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;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: &lt;code&gt;(extend-protocol IFoo (Class/forName &quot;[B&quot;))&lt;/code&gt; does work.&lt;/p&gt;
&lt;p&gt;Related issue: &lt;a rel=&quot;nofollow&quot; href=&quot;https://clojure.atlassian.net/browse/CLJ-1381&quot;&gt;https://clojure.atlassian.net/browse/CLJ-1381&lt;/a&gt;&lt;/p&gt;
</description>
<category>Clojure</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/13723/spec-for-extend-protocol</guid>
<pubDate>Wed, 14 Feb 2024 14:05:57 +0000</pubDate>
</item>
</channel>
</rss>