OK, I'm game. Care to elaborate?
OK, I'm game. Care to elaborate?
There are libraries that make this better (example: https://github.com/kriskowal/q). But since they're not built into the language itself, you end up with more verbose code that's harder to debug when it breaks, and you can't easily interoperate with other code that uses a different flow control library.
There are lots of ways to design a language so that it doesn't suffer this problem. If you simply built an API like Q's into the spec for Javascript so that it had nice syntax and everyone could interoperate using it, that would be a minimum viable solution that retains all Javascript's existing performance characteristics. Alternatively, you can have real coroutines which I think would be even better, though that does change the memory-usage patterns more significantly.