Re:PHP is worth learning and using
by resonious on Thursday November 18, 2021 @07:20AM
(#29264593)
Forgive me for going a little off topic here but is it really true that JS was async-friendly from day 1? When I started using JS seriously 8 years ago, async code was horrible (callback hell, etc.) The web standards guys retrofitted native async way after the matter.
[ Parent
| on HN ]
Doesn‘t this more or less mean "the only execution environment is event based, has a run loop outside of your control and calls your code whenever it wants" and "there is no busy sleep". So it was callback based from day one. Is that the same as async? I think it is?
That makes sense, thanks! It has indeed been run in a loop from the start despite the poor ergonomics - I did not think of it in that light.
Re:PHP is worth learning and using
by tylergetsay on Thursday November 18, 2021 @07:44AM
(#29264768)
async/await is just syntax sugar around promises which are a just a nice way of organizing callbacks, so yes I'd say it's true.
Probably more accurate to say it was async from day one. Which people probably realized the first time they had to deal with setTimeout
The original promises syntax and chaining in ES6 were not particularly user friendly.