<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title>Clojure Q&amp;A - Recent questions tagged malli</title>
<link>https://ask.clojure.org/index.php/tag/malli</link>
<description></description>
<item>
<title>Macro-expansion hooks similar to clojure spec</title>
<link>https://ask.clojure.org/index.php/12956/macro-expansion-hooks-similar-to-clojure-spec</link>
<description>&lt;p&gt;&lt;code&gt;clojure.spec.alpha&lt;/code&gt; currently holds a privileged position as a core library for Clojure core, being able to instrument macros as well as functions. &lt;code&gt;Compiler.java&lt;/code&gt; relies on &lt;code&gt;clojure.spec.alpha&lt;/code&gt; in &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/clojure/clojure/blob/4090f405466ea90bbaf3addbe41f0a6acb164dbb/src/jvm/clojure/lang/Compiler.java#L6967&quot;&gt;this function&lt;/a&gt;, calling &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/clojure/spec.alpha/blob/70f26984ee171f816eee6b162b563d403a49bfe8/src/main/clojure/clojure/spec/alpha.clj#L702&quot;&gt;macroexpand-check&lt;/a&gt; specifically. This is a neat interaction and &lt;code&gt;macroexpand-check&lt;/code&gt; is simple and obvious.&lt;/p&gt;
&lt;p&gt;Other tools (such as Malli) can provide instrumentation for Clojure functions through &lt;code&gt;alter-var-root&lt;/code&gt; (as seen &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/metosin/malli/blob/1a735fe5550b7dccf0832433f2f6d68ce9355edc/src/malli/instrument.clj#L28&quot;&gt;in malli.instrument/-strument!&lt;/a&gt;), but they lack the ability to hook into macro-expansions.&lt;/p&gt;
&lt;p&gt;It would be nice if &lt;code&gt;Compiler.checkSpecs&lt;/code&gt; had some hook to allow for tools such as Malli to be used to instrument macros.&lt;/p&gt;
</description>
<category>Compiler</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/12956/macro-expansion-hooks-similar-to-clojure-spec</guid>
<pubDate>Tue, 23 May 2023 14:18:10 +0000</pubDate>
</item>
</channel>
</rss>