sci

djblue 2023-05-30T23:10:14.257559Z

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

borkdude 2023-06-01T19:41:18.783109Z

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

djblue 2023-06-01T19:41:59.503079Z

Awesome, thanks 🙏

borkdude 2023-05-31T07:22:26.407239Z

We can add support but more details needed.

djblue 2023-05-31T07:32:02.614049Z

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"

djblue 2023-05-31T07:32:53.826789Z

For example, the following code seems reasonable to support https://github.com/mentat-collective/Mafs.cljs/blob/main/src/mafs/macros.cljc

borkdude 2023-05-31T07:57:01.892269Z

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

borkdude 2023-05-31T07:57:58.079919Z

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

djblue 2023-05-31T08:04:25.168179Z

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.

borkdude 2023-05-31T08:11:27.590119Z

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

borkdude 2023-05-31T08:12:33.447589Z

What if you have this construct:

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

borkdude 2023-05-31T09:26:08.688839Z

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?

👍 1
borkdude 2023-05-31T09:26:55.215789Z

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

👍 1