Fork me on GitHub
#sci
<
2023-05-30
>
djblue23:05:14

Are there any plans to support :require-macros in sci or is this something that has to be implemented downstream?

borkdude07:05:26

We can add support but more details needed.

djblue07:05:02

My use case would be when people try to load their existing cljs code into Portal and that code has macros loaded via :require-macros. The macros are doing pure Clojure/Script data syntax transformation so if loaded into sci it "should just work"

borkdude07:05:01

Is the code supposed to run in SCI as well as in normal CLJS?

borkdude07:05:58

Or did you also include the mafs.macros namespace in portal already? and it is just a matter of "treat require-macros as require"?

djblue08:05:25

It would be ideal if it did work in both environments. I haven't added it to Portal, but there is a version of the lib without macros so Emmy viewers in Portal should work fine. It just made me wonder if this is worth supporting by default to reduce friction.

borkdude08:05:27

I'm fine with adding support for it, but I don't know exactly what this would look like since SCI doesn't assume anything about .clj(s,c) files

borkdude08:05:33

What if you have this construct:

(ns foo (:require-macros [foo :refer [my-macro]]))
how should SCI behave?

borkdude09:05:08

At the very least we can make it work exactly like :require and if that's not the correct behavior, change it from there, what do you think?

👍 2
borkdude09:05:55

and if the loaded ns equals the ns we're on, we do nothing?

👍 2
borkdude19:06:18

@U1G869VNV I pushed the first version of :require-macros to SCI master. Feel free to give it a spin

djblue19:06:59

Awesome, thanks 🙏