Re:Crank.js – Write JSX-driven components with functions, pr...
by akritrime on Saturday April 18, 2020 @09:58AM
(#22907756)
Wait that doesn't make sense, was generators in the language before Promises, actually isn't await based on generators? How is that a new paradigm?
[ Parent
| on HN ]
Re:Crank.js – Write JSX-driven components with functions, pr...
by tchaffee on Saturday April 18, 2020 @10:13AM
(#22907863)
Promises and generators were ES6, so around the same time. Although people were using promises long before it became an official feature in ES6. I remember using promises as far back as 2012 or earlier - jquery had them. ES6 was 2015.
Await and async came after in ES7 and can be considered to use yield[1]. So there you go - that's a perfect example of the power of generators. Promises used to be more difficult until they were simplified using generators.
[1] https://stackoverflow.com/questions/36196608/difference-betw...