Fork me on GitHub
#sci
<
2022-09-30
>
Lone Ranger01:09:52

So wait — macros are definable in sci, but importing macros is not. So as long as I import the source code of the dependency it should be fine, right? Except for deftype

Lone Ranger01:09:42

What do they calls those in #babashka ? Super something… where all the scripts get concatenated. So hypothetically with a topological sort of the dependencies, slurping the source code, and concatenating the results — maybe some macros would work :thinking_face:

borkdude09:09:49

@goomba You can copy macros, but if CLJS doesn't have those macros at runtime then there's nothing left to copy

borkdude09:09:04

Copying macros on the JVM works seamlessly, but in CLJS you often have to ensure that they exist at runtime by copying them as functions and adding ^:macro to them, so SCI knows it's a macro

borkdude09:09:28

E.g.:

#?(:cljs 

(defn ^:macro [form env x y z]
  `(+ ~x ~y ~z)))
works with copy-ns and copy-var