lazy-require icon indicating copy to clipboard operation
lazy-require copied to clipboard

Are macros implicit args correctly handled?

Open piotr-yuxuan opened this issue 5 years ago • 2 comments

At least on my machine the following code

(lreq/with-lazy-require [[clojure.core.async :as async]]
  (async/go 1))

produces the following error:

Wrong number of args (1) passed to: clojure.core.async/go

which can be worked around with:

(lreq/with-lazy-require [[clojure.core.async :as async]]
  (async/go nil nil 1))

as macros actually take two more implicit arguments: &env and &form.

piotr-yuxuan avatar Jun 29 '20 16:06 piotr-yuxuan

Addendum: @alexander-yakushev would you accept PR for this?

piotr-yuxuan avatar Jun 29 '20 16:06 piotr-yuxuan

Hello @piotr-yuxuan. The biggest problem is that macros must be expanded in compilation time. Hence, you cannot really postpone the loading of a namespace if you need any macros from it.

alexander-yakushev avatar Jun 30 '20 15:06 alexander-yakushev