This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2024-06-05
Channels
- # aleph (4)
- # announcements (2)
- # aws (37)
- # babashka (20)
- # beginners (105)
- # calva (30)
- # cider (6)
- # clerk (8)
- # cljs-dev (2)
- # clojars (8)
- # clojure (18)
- # clojure-brasil (1)
- # clojure-europe (25)
- # clojure-nl (1)
- # clojure-norway (21)
- # clojure-sweden (7)
- # clojure-uk (5)
- # clr (2)
- # cursive (37)
- # datalevin (2)
- # emacs (6)
- # events (2)
- # graalvm (35)
- # graphql (1)
- # hyperfiddle (3)
- # lsp (4)
- # malli (1)
- # off-topic (7)
- # pedestal (7)
- # practicalli (8)
- # reitit (5)
- # releases (4)
- # remote-jobs (1)
- # shadow-cljs (15)
- # xtdb (19)
@thheller would you be interested in a pr to allow js-await
to chain multiple promises? e.g.
(js-await [db (db "flow")
v (get db id)
ret (put db v)]
(do-stuff ret)
(catch err
...))
I'm undecided on that front. I kinda like it simple, because people will for sure misuse this and treat it like a let
thing which them breaks if something isn't actually returning a promise.
(js-await [db (db "flow")]
(js-await [v (get db id)]
(js-await [ret (put db v)]
(do-stuff ret))
(catch err
...)))
Yeah that ran through my head as well. I considered more complicated things and landed on "only do promises, manually do lets," for myself as well.
Not certain, but I'm pretty sure a recursive js-await
would allow the same level of err handling.
output should be the same as doing the above^ only with fewer manual calls to js-await
not quite, since I moved the error handling one lvl down. so it is not the same technically. but yeah otherwise it is
oh I see what you're saying, yeah but there would be nothing stopping from using that^ way as well if that's what you want