4 ms·
Is there any work done towards enabling Rust + WASM without any JS/npm?
by throwawaylolx 8y ago
Is there any work done towards enabling Rust + WASM without any JS/npm?
- steveklabnik 8y agoWasm requires JS to be loaded by your browser, so it can never fully go away. Outside the browser it’s a different story, of course.
- fabrice_d 8y agoWe could add support for <script src="something.wasm"></script> and not need JS to load it. Once the host bindings are implemented that would be a good fit.
- steveklabnik 8y agoMaybe! There’s not really much demand for such a thing. Web platform people don’t have the disdain for JS that many internet commenters do.
- pedrocr 8y agoIn part because Web platform people have been self-selected to not dislike JS.
- fabrice_d 8y agoI don't disagree with that :) But it would be an interesting experiment to build a JS-free web runtime and see how/if we could get more predictable resource usage this way.
- Keyframe 8y agocough dart cough
- josephg 8y agoI think this sort of thing is always a bigger deal than it seems. I think most people are actually really averse to learning new platforms, and things that enable people to make stuff without having to learn a different platform are way more popular than I would expect. Examples: phonegap, electron, unity, love2d, reactnative, and nodejs itself. (Node = I know web but not native, can you help me write server code without learning C/python). Most of this stuff solves the problem of “I want to program on platform X, but I’m most comfortable in Y. Can someone prevent me from needing to learn X’s paradigms?”. Arguably that’s one of the biggest draws of wasm itself, and why the communities around a lot of languages are excited about it. (Eg rust, blazer). (“Ugh don’t make me learn JavaScript. I already know C# and I like it. Can I just do that instead?”) To your point, I think it seems like there’s not much demand for such a thing because the people it would help aren’t involved enough yet to file issues. If they’re invested enough in the community and the problem, they’re probably invested enough to learn enough JS to bridge the languages themself anyway. Which is all to say, I think making a wasm script tag after host bindings are in is a good idea and will make a lot more people happy than it would seem if you just surveyed the existing community.
- steveklabnik 8y agoEh, I think that the few lines of JS it takes to instaniate a wasm module isn’t a problem even for people who aren’t great at JS. I’m one of those people, and it’s only a few lines, really. It can even be generated by tools. It’s just not that big a deal.
- tokyodude 8y agothe big deal is not knowing the platform and therefore reproducing it in wasm. a simple example is most games compling in libjpg, libpng, zlib when the browser already has that stuff built in.
- ordu 8y ago> Web platform people don’t have the disdain for JS that many internet commenters do. I'm not a web platform person, but I have coded some wasm application as a part of my undergraduate course work, and it is really annoying to use javascript just because rust code cannot be initialized without this BASIC of XXI century. Outdated unsafe language with outdated unsafe API for DOM access on top of modern language with an ability to design strict, safe and elegant APIs. One need not to be a guru of JS to get access to DOM and to initialize wasm-module, and to write the majority of code in rust, but all this javascript stuff feels like a fifth wheel for a cart: maybe it doesn't hurt much, but it is a dead weight at least. I mean, I'm not a web platform person, and it is far far away from my day to day work, so maybe I see it all wrong, but I believe that javascript is doomed, like any other fifth wheel. It will last, maybe decade or even more, but it is doomed.
- Technetium_Hat 8y ago...but it couldn't interact with the DOM or do anything else without JavaScript.
- steveklabnik 8y agoThat’s why your parent said “once host bindings are implemented.”
- throwaway23H 8y agoIf you mean producing a wasm module without touching third-party tooling, then this can already be done with Rust today. The standard rust compiler is capable of cross-compiling out of the box, so the only thing you need in order to produce a working wasm module are the standard libraries which can be obtained from rust-lang.org. I wrote a somewhat detailed guide about the process here: https://www.reddit.com/r/rust/comments/9t95fd/howto_setting_up_webassembly_on_stable_rust/ https://www.reddit.com/r/rust/comments/9t95fd/howto_setting_...