Hacker News new | past | comments | ask | show | jobs | submit login

Yes, your example isn't complaining about then() being clearer than await (because it isn't) but rather complaining that top level await isn't everywhere yet.

In other words, your complaints have disappeared in node, and will soon in browsers: https://github.com/tc39/proposal-top-level-await

So yes:

    set(await get())



Sometimes you may need to handle a promise in a function that can't be made async.


If a function is inherently sync, then it shouldn't be using promises.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: