5 ms·
I'm still waiting for better toolchains. WASM is really the greatest thing, but it's lacking proper support from compilers. Binaryen seems like a beast to use.
by jokoon 7y ago
I'm still waiting for better toolchains.
WASM is really the greatest thing, but it's lacking proper support from compilers. Binaryen seems like a beast to use. I don't really understand why WASM is not just supported natively directly by clang or gcc.
- tjelen 7y agoIsn't it already supported backend in LLVM? https://github.com/llvm/llvm-project/tree/master/llvm/lib/Target/WebAssembly https://github.com/llvm/llvm-project/tree/master/llvm/lib/Ta... I mean it is still under development but I think it is usable. Here's a quick intro I found some time ago: https://dassur.ma/things/c-to-webassembly/ https://dassur.ma/things/c-to-webassembly/
- froydnj 7y agoThe WASI tutorial for compiling C/Rust to wasm and running it has some useful information on this front: https://github.com/bytecodealliance/wasmtime/blob/master/docs/WASI-tutorial.md https://github.com/bytecodealliance/wasmtime/blob/master/doc... We wouldn't have been able to put wasm in Firefox like this if there wasn't decent compiler/runtime support via the clang ecosystem.
- wahern 7y agoThat C code has a bug where the inner write loop writes the same portion of the buffer after a short write. The Rust code, by contrast, slurps up the entire file contents into a buffer before writing it out. If someone is going to write code that way why even bother with a low-level language? (This "memory is infinite" mentality is something I've noticed in other Rust projects, even major ones like mio.)
- sunfish 7y agoGood catch on that bug! I'll fix that. Beyond that, that file is just a simple example for showing how to work with the toolchain and the sandbox.
- nicoburns 7y agoYou could try Rust. It seems pretty simple to compile to wasm: https://developer.mozilla.org/en-US/docs/WebAssembly/Rust_to_wasm https://developer.mozilla.org/en-US/docs/WebAssembly/Rust_to...
- azakai 7y agoWasm is already supported natively by clang. Binaryen is an optional optimizer that you can run on the emitted wasm, to make it smaller (either manually, or a toolchain may integrate it for you, like emscripten or wasm-pack).
- greggman3 7y agoTinyGo looks pretty interesting https://tinygo.org/ https://tinygo.org/