3 ms·
Is there support for GoLang to WebAssembly? Or will it be more of a GopherJS to WebAssembly? Thanks
by no1youknowz 10y ago
Is there support for GoLang to WebAssembly?
Or will it be more of a GopherJS to WebAssembly?
Thanks
- kibwen 10y agoThe initial MVP of WASM won't have privileged support for any custom runtime services, so in order to run Go code in the browser (or any other GC'd language) you'd have to compile the entire runtime with it and ship it all over the wire to the client. Eventually they do hope to lift this restriction.
- hackcasual 10y agoThe other issue is that a lot of GC implementations do stuff that's incompatible with asm.js/WASM like inspecting function stacks.
- couchand 10y agoNot entirely incompatible... an implementation could manage the stack explicitly.
- hackcasual 10y agoNot sure what you mean? Libraries like libgc can't be directly ported over to Emscripten since they depend on platform specific behavior to inspect the execution stack and registers. In asm.js/WASM the execution stack is not inspectable from code.
- couchand 10y agoRather than using the execution stack provided by the environment (by using the built-in calling conventions directly), you could manage your stack on the heap using the linear memory facilities. Function calls are a bit more expensive, since now you need a macro to convert calling conventions. But it's definitely not impossible, and it's not even really all that hard (just tedious).
- scriptproof 10y agoGo seem to be planned, according to the announcement: "support to coroutines for languages that implement it".
- kibwen 10y agoWhere is that quote from? I can't find it on any of the three announcement pages.
- scriptproof 10y agohttp://webassembly.org/docs/future-features/#coroutines http://webassembly.org/docs/future-features/#coroutines Linked from the article.
- weitzj 10y agoAt dotGo 2016, Paris, a GopherJS contributor said in his talk that WebAssembly is probably not a goal of GopherJS. "Targetting WebAssembly (wasm) is the next step, but not yet ready. It won't be GopherJS" https://dmitri.shuralyov.com/talks/2016/Go-in-the-browser/Go-in-the-browser.slide#40 https://dmitri.shuralyov.com/talks/2016/Go-in-the-browser/Go...