Open pesterhazy opened 6 years ago
FWIW, this could be implemented as a repl special, along the lines of require
.
@pesterhazy I'm curious to hear what the clojurescript plan for support for await
given that it's a keyword and not a generic function. However just for repl purposes, it seems like an await macro that expands to callbacks might suffice?
what about extending ReadPort
from core.async
?
I am working with Promise
too and it's not fun ^^
@bhurlow, a macro won't enable the same experience. Inevitably any fn call returns to the prompt before the async result arrives. Printing out the result will print over the prompt - overall janky.
The feature you'd need to prevent this is some way to instruct the repl to block until a promise is resolved.
In fact this is quite different from regular js await
.
@anmonteiro could you please update us whether this feature is coming soon in lumo scripts soon ?
has anyone attempted an "async" repl? would love to use one, even if just for top level await on promises
Most node APIs are asynchronous, often based on promises. Experimenting with promises from the REPL is not as nice as it could be however:
It would be great to be able to request a promise synchronously from the REPL:
The REPL would block until the promise is resolved or until the user hits
^C
.For JS, the feature has landed in the Chrome devtools and Safari already, and it's being discussed in node.