squint
squint copied to clipboard
Macros get resolved as normal functions
version v0.7.110
problem following the usual clojurescript behavior, this macro should be executed during compilation:
;; file test.cljs
(ns test
(:require-macros [test]))
(defmacro two [] 2)
;; file test_runner.cljs
(ns test-runner
(:require [test]))
(test/two)
but test_runner.js gets compiled to
import * as squint_core from 'squint-cljs/core.js';
import './test.mjs';
test.two();
I need to provide both functions and macros in the same namespace, so that they can be used with the syntax myns/mymacro.
For example, the solid namespace I'm writing should provide both solid/for (a macro) and solid/render (a normal function).
This isn't supported in cherry / squint. Macros should always be loaded using :require-macros. This is done because files in cherry and squint can be recompiled without scanning other files in your project. It's unlikely to change any time soon I think.