News for hackers. Stuff that matters.
Re:Rust: Enable WebAssembly backend by default by steveklabnik on Sunday November 26, 2017 @10:49AM (#15781374)
It totally works, it's just not particularly easy to do. wasm modules have import and export sections; you'd instantiate the std module first, the instantiate the module that depends on it, pointing its imports at std's exports. I don't know of any tooling that makes this super easy at the moment though, you basically have to do it by hand as far as I know.
Re:Rust: Enable WebAssembly backend by default by kodablah on Sunday November 26, 2017 @11:27AM (#15781578)
I don't think you can at runtime from wasm though. Imports are resolved at load time. Sure there are call indirect that let you dynamically change the function index but not the import/export. Now if you were willing to reload, you could use the JS API to create modules at runtime with dynamically downloaded pieces, but once created, that's it I think.
Re:Rust: Enable WebAssembly backend by default by steveklabnik on Sunday November 26, 2017 @11:51AM (#15781693)
Sure, I'm talking about "instantiate one big module" vs "instantiate several smaller modules, then finally the last module". Which is a bit different than what you're talking about; you're right that after you've instantiated, you can't change imports.
Re:Rust: Enable WebAssembly backend by default by drhodes on Sunday November 26, 2017 @11:30AM (#15781596)
great, thanks, that clarifies things quite a bit.