Closed isaackwan closed 1 year ago
This proposal is not yet fully standardized, but at the current stage we don't believe it to be a good fit for Cheerp (or WebAssembly in general)
anyref
/externref
feature). So it is possible to receive and use Promise
objects from JavaScript as they were any other object.async
/await
everywhere, but we suspect that such a solution might have significant performance impact.For all these reasons we believe that, at least as things stand, we will not implement this feature in Cheerp.
Note that accessing Promise objects from wasm is not likely to be 'smooth' for the foreseeable future.
Note also that there is additional work around bringing stack switching capabilities to wasm. Some of your concerns may be addressed or amplified by that work. Core stack switching is much earlier on in the process at the moment.
@fgmccabe The main issue of this proposal in the context of Cheerp is that (afaik) it does not allow to suspend a stack frame that contains JS functions.
It is understandable why (you could use this to wrap js functions and make them suspendable, but the JS committee does not like that), but in Cheerp it is very common to have mixed stack frames, because you can tag your C++ functions so that they are compiled into JS or Wasm.
The result would be difficult to debug runtime errors that appear if you change the implementation details of some function. And detecting these situations at compile time is not really feasible.
Yes, well, we are prohibited from allowing JS frames to be captured in this way. The principal reason is that that would change the semantics of JS itself. And, as you note, it does introduce some 'glitches'.
Any plans to add support for https://github.com/WebAssembly/js-promise-integration/ please?