4 ms·
the entire C/C++ ecosystem are WASM frameworks, thanks to emscripten, you can basically use everything rust is stuck with "rewrite everything to be usable", it
by Shadonototra 4y ago
the entire C/C++ ecosystem are WASM frameworks, thanks to emscripten, you can basically use everything
rust is stuck with "rewrite everything to be usable", it can't consume any of that
zig on the other hand.. it can, i think it'll have a bright future
- jeroenhd 4y agoRust wasm support seems quite excellent, though? I haven't had too many issues with getting wasm output out of Rust. Emscriptem, though, has been a whole different story. I suppose it depends on what tool chains you're used to using. I don't expect Zig to do any better or worse than Rust in this regard.
- flohofwoe 4y agoZig can (eventually) do better than Rust because it includes the ability to compile C/C++ code to WASM, Rust needs an external C/C++ compiler for this (so you're back to having to deal with Emscripten if you need to embed C/C++ libraries in your Rust project).
- jeroenhd 4y agoThe same is true in reverse, though, you need an external Rust compiler if you include Rust code in your C++ project. Mixing compilers and languages will always cause conflicts, I don't think either Emscripten or Zig will be any different other than that Zig has some backwards compatibility with C/C++.
- azakai 4y agoThey are good for different things, atm. Rust is focused on people writing new code for the Web, and does well there. C++ is focused on porting existing applications, which works well for things like Unity, Photoshop, Google Earth, etc. The reverse cases are sadly not that great atm. If you have a Rust application that uses SDL2 and OpenGL, for example, porting it to the Web is not that easy (you either need to port those APIs to something else, or mix Rust and C to get Emscripten's SDL2 and OpenGL support). And if you want to write new C++ code just for the Web, current bindings solutions are not polished enough. But hopefully all those things will keep improving!
- TazeTSchnitzel 4y agoHuh? You don't need to mix Rust and C, Rust has direct Emscripten support. I've used it + rust-sdl2 for a game project.
- azakai 4y agoTrue, but there is an unfortunate amount of bugs in that area. We (I'm an Emscripten dev) would like to look more into improving Rust's Emscripten support, but there have just been higher priority items for us (and I guess others) so far.
- TazeTSchnitzel 4y agoYeah that's certainly true, I've had to use weird compiler flags to get it to work properly.