Hacker News new | ask | show | jobs
by KingOfCoders 2221 days ago
It's more that you don't need to add 'async' to each function, because every function is async. And working with promises automatically maps over them. Then if you want to 'unbox' the Promise you'd have a keyword, like await.

So instead of a.map(v => f(v)) ... or Promise.map(a, f) ... or a.map(f) ... it's just f(a).

If you then want the value, in the end, if at all (e.g. the web framework understands Promise and you return a Promise in your controller and not a value, you don't need await at all).

You'd need some syntax for Promise.all(...) though to "join" concurrent executions again.

The language should probably have some syntax for multiple writers, e.g. and atomic compareAndSet.

   shared v = { .... }
   v.change(v, f) 
where f has no side effects and can be executed again. With IO (DB) one would need support for idempotency ala Stripe.

But your functions would not have colors.