If you do (doc ns)
you'll see a description of how :refer-macros
and :include-macros
can be use in ns
forms as inline macro specification sugar,
along with an example and the desugared result.
This desugaring is done within the ClojureScript compiler, and in regular (JVM-based) ClojureScript, the associated desugaring algorithms are invoked as Clojure.
But, now that we have bootstrapped ClojureScript, it is easy to call directly
upon the compiler to see what any given ns
form will desugar into.
Here is an example showing how to do so within Planck:
First import the analyzer namespace and define a desugar
function that wraps
the underlying capability:
(require '[cljs.analyzer :as ana])
(defn desugar [[_ ns & specs]]
(list* 'ns ns (ana/desugar-ns-specs specs)))
With this in place, you can easily produce the example that appears in (doc ns)
:
(desugar '(ns testme.core
(:require [foo.core :as foo :refer [foo-fn] :include-macros true]
[woz.core :as woz :refer [woz-fn] :refer-macros [app jx]])))
will produce the following (wrapped for readability)
(ns testme.core
(:require (foo.core :as foo :refer [foo-fn])
(woz.core :as woz :refer [woz-fn]))
(:require-macros (foo.core :as foo)
(woz.core :as woz :refer [app jx])))