Closed nullstyle closed 10 years ago
I try to keep the modification as minimal as possible, so I just customise the repl and implement the .then(console.log)
part, that keeps us to run other script as before.
please have a review
https://github.com/lookis/stex/commit/1a542c3f6a49394e10631fb0a465963f956da408
STORY
As a developer running in a stex console process, I want to be able to execute javascript that returns a promise which is then resolved before printing, so that I can have a more friendly asynchronous experience when using the REPL.
RATIONALE
Presently, the stex repl process is very bare-bones... simply using the built in node 'repl' module with no customization. Given that most of the useful code in node is asynchronous (and for stex, promise-based), the repl is quite hard to use because you pretty much end up having to write lines like:
db("wallets").where("id", id).select().then(console.log)
This is a pain and slows down the explorative experience of a repl, IMO. It would nicer instead if we built a repl that saw the return value of a statement was a Promise, resolve it, then printout the value for the developer... essentially automating the
.then(console.log)
part.