Fork me on GitHub
#cljs-dev
<
2024-03-19
>
souenzzo12:03:35

Will cljs support some kind of the new method syntax? Something like this: (-> (js/fetch ...) (Promise/then (fn ...))?

borkdude12:03:17

I guess for this to work (like in JVM Clojure 1.12) CLJS would have to have some runtime analysis to decide whether to compile to .then() or Promise.then() which it currently doesn't have (I believe, correct me if I'm wrong). One other thing here is that Promise is a global object, so you have write something like (js/Promise.then ..) or so, for it to resolve to something meaningful?

souenzzo13:03:56

Not sure. I was just thinking about what release 1.12 would be like It may make sense in some scenarios: (js/Array.map arr inc) may generate some code like: Array.prototype.map.call(arr, inc) I don't know if it would be useful. It would probably need some runtime info...

borkdude13:03:38

(js/Promise.prototype.then.call (js/Promise.resolve 1) prn)
#object[Promise [object Promise]]
1
That's a lot more code though? ;)

thheller13:03:59

IMHO most of the stuff is not needed, given that JS is much more dynamic than Java you can pretty much go without any type info whatsoever

👍 1
dnolen19:03:55

@thheller I saw they cut new GCC, any change for shadow?

👀 1
thheller19:03:25

oh missed that. will check later and let you know.

thheller18:03:52

I just tested the release and it seems ok. the npm packages that have been previously reported as failing now compiled without issues. can't say if they actually worked, but at least no compiler errors anymore. pushed a new shadow-cljs version using it.