Self-host: allow namespaces to require their own macros
Description
Currently a namespace can only require its own macros in JVM ClojureScript (called macro-loop in this post).
Because there's no reader conditional distinction between JVM and Bootstrapped ClojureScript, requiring a namespace that requires its own macros in self-host will result in the following error:
Could not require foo.core in file /Users/anmonteiro/Desktop/foo/src/foo/core.cljc
Maximum call stack size exceeded.
Below is an example that can be used to reproduce the issue:
This ticket proposes the following solution: when loading a macros namespace in self-hosted ClojureScript, patch its `require-macros` and `use-macros` entries to remove itself, if present.
Currently a namespace can only require its own macros in JVM ClojureScript (called macro-loop in this post).
Because there's no reader conditional distinction between JVM and Bootstrapped ClojureScript, requiring a namespace that requires its own macros in self-host will result in the following error:
Could not require foo.core in file /Users/anmonteiro/Desktop/foo/src/foo/core.cljc Maximum call stack size exceeded.
Below is an example that can be used to reproduce the issue:
;; foo/core.cljc (ns foo.core #?(:cljs (:require-macros [foo.core]))) (defmacro a-macro [& args] `(println ~@args))
This ticket proposes the following solution: when loading a macros namespace in self-hosted ClojureScript, patch its `require-macros` and `use-macros` entries to remove itself, if present.