We're updating the issue view to help you get more done. 

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:

1 2 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:

1 2 3 4 5 6 ;; 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.

Environment

None

Status

Assignee

David Nolen

Reporter

António Monteiro

Labels

None

Approval

None

Patch

Code

Fix versions

Priority

Major