2 ms·
The "problem" with integrating with the host gc is that it means language who have subtly different approaches to garbage collection can't trust compiled code b
by danShumway 8y ago
The "problem" with integrating with the host gc is that it means language who have subtly different approaches to garbage collection can't trust compiled code behavior to be identical in the browser.
This is probably not a terrible thing, since a native garbage collector in WASM (unless it was designed in an extremely simplistic, low-level form) would also probably not be suitable for the diversity of the languages that want to include one.
It is (probably) better for individual languages to write their own, even if that increases binary sizes.
- SquareWheel 8y agoIt would be neat if they could be cached as language-specific GCs, rather than having to be bundled individually with each application.
- danShumway 8y agoThis is something that interests me as well. If you have separate WASM binaries, right now they have to be on separate threads. For many languages, that may not matter, but it would be interesting to see if there was some way to split up a WASM binary on the same thread and apply caching to some of it.
- skybrian 8y agoOf course, if you have a bunch of languages that compile to JavaScript, they all share the same low-level object layout and garbage collector. This VM has a lot of momentum. The problem is that languages that are genuinely different from JavaScript (such as Dart and Go via gopher) have their own static linkers that generate a big blob of JavaScript. To really do interop right, you need to share a common linker and data format for public API calls. And to make this efficient, it needs to handle inlining and tree-shaking. At that point you might as well use JavaScript or a light overlay language like TypeScript. With wasm, similarly, a common language runtime should probably have its own linker that combines and optimizes libraries and emits a wasm file.