Re:WebAssembly
by vsskanth on Saturday February 27, 2021 @09:25PM
(#26290107)
Can someone educate me why GC based languages aren't supported in wasm ?
[ Parent
| on HN ]
Re:WebAssembly
by jillesvangurp on Saturday February 27, 2021 @10:57PM
(#26290550)
Garbage collection support is coming; 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.
Wasm 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.
Is there a js engine implemented in wasm?
I think Figma wound up using one.
be careful of cycle-collection problems.
Re:WebAssembly
by neallindsay on Saturday February 27, 2021 @09:52PM
(#26290226)
It'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.