This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-08-15
Channels
- # architecture (2)
- # beginners (16)
- # boot (2)
- # cider (4)
- # clara (6)
- # cljs-dev (78)
- # cljsrn (3)
- # clojure (158)
- # clojure-austin (1)
- # clojure-belgium (1)
- # clojure-dusseldorf (19)
- # clojure-italy (8)
- # clojure-russia (3)
- # clojure-spec (77)
- # clojure-uk (61)
- # clojurescript (341)
- # cursive (9)
- # data-science (12)
- # datomic (18)
- # emacs (9)
- # fulcro (109)
- # hoplon (10)
- # juxt (2)
- # leiningen (2)
- # lumo (31)
- # off-topic (1)
- # om (4)
- # onyx (40)
- # parinfer (17)
- # re-frame (36)
- # reagent (19)
- # spacemacs (10)
- # vim (60)
- # yada (20)
Top-level await is coming to the chrome dev tools: https://twitter.com/umaar/status/897408737694109697
Something like that for lumo would be awesome
@pesterhazy what do you mean
probably very easy to do with a macro
I think it requires support from the repl infrastructure
essentially this feature makes the prompt block until the (async) response comes back
as far as I understand it at least?
I mean this works today
(async () => `Homepage: ${(await fetch(location.href)).status}`)().then(console.log)
right
blocking will need extra support
otherwise it can be achieved
i'm curious how they handle a promise that never fires...
like:
(defn x []
(js/Promise. (fn [resolve reject] (resolve 42))))
(js* "(async () => ~{}(await ~{}))();" js/console.log (x))
haha nice
^ can easily turn that into an await
macro
that you call like (await js/console.log (x))
right
hm...
still not sync
what if lumo detected a promise as a return value and (optionally) awaited its result
for example, (await ...)
could be a repl-special
that'd be amazing for experimenting with async apis which, honestly, is most apis in node
so (await (x))
would block until ^C or a promise resolution
(await)
would be accepted only as a top level form
I guess similar to (require)
?
@pesterhazy feel free to open an issue
that’d probably require some tinkering and refactoring
but sounds like a good idea
ok will do