Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

What's truly missing for Wasm and WASI to be an alternative to POSIX is dynamic instatiation so that a Wasm program/component can start another Wasm program/component by providing the bytecode at runtime. So far I don't think anyone is working on that.


in the browser you can compile modules and create instances from arrays of numbers/bytes, here's an obfuscated example: https://wasmgroundup.com/blog/wasm-compiler-in-a-tweet

if the host provides the guest wasm module via imports a function to create and run from an array of bytes then it can be done today (if I understand you correctly).

Here's some related content: https://github.com/pdubroy/til/blob/main/wasm/2024-02-22-Run...


Yes, this can be done today, though it needs some gluing together. On the Web (and in Node etc.) you can use JavaScript to create and link the modules, which is how dynamic linking support for wasm works there:

https://emscripten.org/docs/compiling/Dynamic-Linking.html


On the Web, you can do that today. This is what https://webvm.io does for example. It jit-compiles Wasm modules at runtime from the original X86.


The wasp runtime has a run_wasm host export but I guess that's cheating

https://github.com/pannous/wasp


I wonder if it hasn't been done because it would break the security model


does it? a program would be able to spawn another program only with the exports available to him




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: