3 ms·
Why Coroutines Won't Work on the Web
- Arelius 15y agoThe stack argument is poor. There are plenty of solutions to this, from just multiple stacks, to the more commonly used in dynamic languages, grow able stacks. In a dynamic stack, it's trivial to add in stack pointers to redirect to parent stack segments. And the C++ problem is also easy to deal with in such a scenario. For starters, C++ code doesn't need to share the same stack. And even if you choose to do such, the observation that most native functions called from JS would not need to directly recurse shows that native functions can operate in bounded stack space, allocated before the call. And all recursion, will either go through the JS runtime, or in the other rare cases, can be trivially modified to, us giving you frequent stack growing boundaries at every JS call. Coroutines in JavaScript isn't a technical problem. In fact, I imagine this to be rather trivial in comparison to what modern JS engine engineers do these days.