Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Macros get resolved as normal functions #533

Open
ranfdev opened this issue Jun 2, 2024 · 1 comment
Open

Macros get resolved as normal functions #533

ranfdev opened this issue Jun 2, 2024 · 1 comment

Comments

@ranfdev
Copy link
Contributor

ranfdev commented Jun 2, 2024

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).

@borkdude
Copy link
Member

borkdude commented Jun 2, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants