3 ms·
Can someone educate me why GC based languages aren't supported in wasm ?
by vsskanth 6y ago
Can someone educate me why GC based languages aren't supported in wasm ?
- Kuinox 6y agoC# is supported in WASM...
- neallindsay 6y agoIt's not that they can't be supported, but they generally have a big runtime, so your compiled output would be big. If you're running WASM in the browser then that's a big image that you need to send to the client.
- lmkg 6y agoWasm itself is at the level of assembly, not the level of JavaScript. If you want to compile a GC'd language to wasm, you have to bring your own garbage collector and compile it to wasm as well. That's not a showstopper from wasm's perspective, and several languages have done just that, but porting a GC to a new compilation target can be a bit of work.
- jillesvangurp 6y agoGarbage collection support is coming; https://bugs.chromium.org/p/v8/issues/detail?id=7748 https://bugs.chromium.org/p/v8/issues/detail?id=7748 They've been working on adding that for a while in the standard. But it's a complex topic, which is why it is taking time. You can of course bundle your own garbage collector and statically compile it into wasm. That's why Go, C#, etc. can target WASM. Jetbrains is actually working on a compiler backend for wasm in their new IR compiler for Kotlin. Apparently they are planning to not bundle their own GC and will try to rely on the WASM gc when that is ready. I'm not sure how close they are to having a usable release. But I expect early betas might start happening late this year or next year.