5 ms·
Question for anyone with real WASM experience: what are your top recommended entry points / reference materials? AssemblyScript seems pretty approachable at 1st
by chrisweekly 6y ago
Question for anyone with real WASM experience: what are your top recommended entry points / reference materials? AssemblyScript seems pretty approachable at 1st glance...
- the_duke 6y agoRust has the best tooling for wasm and is easiest to get started with, in my opinion. `rustup target add wasm32-unknown-unknown` `cargo build --target=wasm32-unknown-unknown` Is all you need to compile a Rust library to a `.wasm` file. (almost, you also need a setting in Cargo.toml: [lib] crate-type = ["cdylib", "rlib"] ) In the browser you can get access to DOM apis via web-sys. The documentation has quite a lot of examples and info: https://rustwasm.github.io/wasm-bindgen/web-sys/index.html https://rustwasm.github.io/wasm-bindgen/web-sys/index.html wasm-pack (https://github.com/rustwasm/wasm-pack https://github.com/rustwasm/wasm-pack) makes building code for the browser easy.
- McGlockenshire 6y ago> In the browser you can get access to DOM apis via web-sys. Wow! The last time I looked, doing anything remotely like this was a gigantic pain, in any language. I guess it's finally time for me to get around to learning Rust.
- pjmlp 6y agoAssemblyScript is one of the best options, because if the only thing you care about is some high level language that outputs WebAssembly, then you are still using Web related tools. Then D is quite easy to use (LDC alongside betterC mode, runtime is still not fully ported). Followed by TinyGo, Rust, C#, Nim. I would leave Emscripten, C and C++, only for porting existing code into the Web, as even with the sandbox memory corruptions of data allocated in the linear memory blocks are susceptible to occur.
- benjaminjackman 6y ago> corruptions of data allocated in the linear memory blocks are susceptible to occur I don't know if I quite understand this. Is this a web-assembly specific thing, or just the standard C / C++ are "unsafe by default" languages which can cause memory corruption etc because e.g. of off by one errors in pointer arithmetic and so on.
- pjmlp 6y agoThe usual stuff with C and C++. WebAssembly doesn't do bounds checking, besides being in bounds of a linear memory segment. Basically the access is still in bounds of the allocated memory, but not the cells that one actually wanted to access. From security point of view, while the WebAssembly module is sandboxes, such corruptions can be triggered from the outside, changing the behaviour of the public API.
- dboreham 6y agoI've played around with Haskell via the Asteruis project : https://github.com/tweag/asterius https://github.com/tweag/asterius Also emscripten of course, for C/C++.
- yodalf 6y agoEmbedded engineer here. We used it to implement a complex, browser-accessible debugger interface for an industrial analyser device. Fast real-time graphs, buttons, menus, etc... It typically loads in a few seconds in your browser. Works wonders. We used emscripten + imgui + implot ... All C++ and zero interaction with the low-level WASM itself. Recommended.
- jedisct1 6y agoZig has excellent support for WebAssembly (out of the box, no need to install anything else). The resulting modules are small and fast.