3 ms·
Exceptions still don't work! That ends up making lots of C++ code not compilable.
by matthewbauer 7y ago
Exceptions still don't work! That ends up making lots of C++ code not compilable.
- azakai 7y agoThat's not a limitation of WASI - WASI is just the system APIs. Exceptions don't work natively in wasm yet, that's true. But they do work in wasm+JS (using JS exceptions for unwinding, in Emscripten).
- matthewbauer 7y agoYeah, Emscripten does support exceptions, but I don't think Emscripten creates WASI yet? It would be useful to separate out the exception handling from Emscripten to a runtime library so that other projects could use it, without relying on the entire Emscripten toolchain. I suspect we'll get exception handling at some point, but for now so much stuff just does not work without it. The whole idea of WASI is that it is not JavaScript-specific, so needing some JavaScript code just to get this basic feature is kind of surprising.
- azakai 7y agoEmscripten does use some WASI APIs already, both normally and especially in standalone mode [1]. But yeah, for now WASI and wasm don't provide enough to do things like C++ exceptions, longjmp, etc., so Emscripten supports them using non-WASI APIs. Native exception handling for wasm is being worked on. If we don't want to wait for that, we could do exceptions using Asyncify [2]. But since we have the JS+wasm option for now, and native support coming, that's maybe not worth it. [1] https://github.com/emscripten-core/emscripten/wiki/WebAssembly-Standalone https://github.com/emscripten-core/emscripten/wiki/WebAssemb... [2] https://www.youtube.com/watch?v=qQOP6jqZqf8 https://www.youtube.com/watch?v=qQOP6jqZqf8