is it possible to use lumo to build binaries from Clojure programs? If so how?
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