3 ms·
Prior to the introduction of async/await (or promises) there were a number of places we used a similar technique inside Firefox to avoid callback spaghetti. Fo
by yoklov 8y ago
Prior to the introduction of async/await (or promises) there were a number of places we used a similar technique inside Firefox to avoid callback spaghetti.
For us it caused no end of problems, and were glad to see it go (well, there are still probably some places using it...).
It's not surprising to me that it's discouraged.
- veli_joza 8y agoCould you point out what the problems were, and what technique did you replace it with?
- yoklov 8y agoA long tail of subtle event and reentrancy bugs, where an event loop wasn't getting an event it needed (leading to dropped or mishandled OS events), or a function that doesn't expect to need to be reentrant was suddenly reentrant. Most of these could be worked around, but some of them are unreasonably difficult given OS event apis. We replaced it with just making the calls that might need to be asynchronous use `async`/`await`.