Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

What? In JS async/await is _literally_ syntactic sugar for returning/thening promises.


They need to have experience and intuition working with promises without syntactic sugar, before being allowed to use syntactic sugar.

It's a basic way to learn. In Python you don't directly teach people about decorators without first asking them to explicitly reassign a function to the result of calling the decorator. In Haskell you don't teach people about do notation without first making them write nomadic code with the bind operator and many lambdas.

In many cases, just a few days of forbidding students to use the syntactic sugar is enough to make them appreciate why this syntactic sugar is needed and how it is supposed to be used. JavaScript's async/await is the same.




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

Search: