Please consider my reply as one from a junior ClojureScript programmer. Most time of the day I write TypeScript and in our codebase there are lots of code using async/await
. I think async functions is already part of the daily jobs among JavaScript/TypeScript programmers(at least in China).
I agree that core.async
offers more powerful abstractions. However it’s really trivial now to write async function f(){ }
and await f()
to finish async tasks. Why do we want to translate the code into go
blocks when a simpler way is already presented?
My example was using Koa. When I wanted to use Koa, I opened the docs of Koa, and translated the JavaScript into ClojureScript. It’s just too much work if I need to think about promises and go
blocks, while with await
it’s just adding two words:
// logger
app.use(async (ctx, next) => {
const start = Date.now();
await next();
const ms = Date.now() - start;
console.log(`${ctx.method} ${ctx.url} - ${ms}`);
});