This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2024-03-19
Channels
- # announcements (5)
- # babashka (49)
- # beginners (11)
- # biff (5)
- # calva (123)
- # clerk (9)
- # cljdoc (5)
- # cljs-dev (9)
- # clojure (62)
- # clojure-europe (32)
- # clojure-nl (1)
- # clojure-norway (54)
- # clojure-uk (3)
- # clojurescript (30)
- # community-development (5)
- # cursive (9)
- # devops (5)
- # events (1)
- # fulcro (35)
- # graalvm (10)
- # gratitude (3)
- # hyperfiddle (9)
- # jobs (3)
- # keechma (1)
- # lsp (10)
- # malli (14)
- # off-topic (42)
- # overtone (1)
- # releases (3)
- # shadow-cljs (66)
- # squint (153)
- # xtdb (19)
Will cljs support some kind of the new method syntax?
Something like this: (-> (js/fetch ...) (Promise/then (fn ...))
?
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?
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...
(js/Promise.prototype.then.call (js/Promise.resolve 1) prn)
#object[Promise [object Promise]]
1
That's a lot more code though? ;)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