5 ms·
JavaScript and Rust are so opposite in their goals and design that I wonder why something like this is written...
by jfkebwjsbx 6y ago
JavaScript and Rust are so opposite in their goals and design that I wonder why something like this is written...
- oh_boy 6y agoBecause it is easier to learn programming language X when you can compare it to what you know from programming language Y. Articles like this are most likely the first thing I'm looking for to have a kick-start into a new field.
- kohtatsu 6y agoI think you just answered your own question.
- steveklabnik 6y agoWouldn’t that imply that it’s needed more? The more different two things are, the harder it is to get from A to B, and the more a map is useful.
- jfkebwjsbx 6y agoThe question is whether enough people need such a map.
- steveklabnik 6y agoIn that case: yes, we have a lot of JS people coming to Rust. The difference helps explain that too: if you’re going to learn something, learning something that’s very different from what you’re used to means you get more out of it than learning something similar. When I decided I wanted to move away from Ruby, I didn’t even consider getting deeper into Python. Why would I? They’re so similar that the cost/benefit ratio is off, at least for me back then. YMMV of course. Oh and finally, not every bit of writing has to be extremely useful or hit a wide audience. Sometimes people write things because they want to.
- jfkebwjsbx 6y agoGood points, but when I have done that, I always preferred to start fresh, rather than take a "shortcut" map from A to B. The reason is that otherwise you always try to map things back to your previous knowledge and expertise, which can make you biased or give you tunnel vision. "If you have a hammer..."
- steveklabnik 6y agoYeah, I totally get that. Different people learn differently. :)
- sharms 6y agoI have professionally come across many website backends that were developed in Javascript. Over time we are seeing projects that add more robustness, performance, and ability to support in the form of Typescript and now Deno. With WASM becoming mainstream and the growing maturity of the Rust ecosystem, it appears to be a solid choice for backend systems and potentially emerging frontend use cases.
- jfkebwjsbx 6y agoIf they wanted something better for the backend (for robustness of performance reasons) there are other alternatives much better suited for the vast majority of backends. For instance, C#. WASM is not needed for the backend, so that is not the reason either. For frontend, I can see it for some pages (I used it myself), yes, but there are also other languages that can target WASM. You also mention maturity of Rust, but other languages in its domain are more mature, so that cannot be it either.
- TomMarius 6y agoWASM is not required, but having a sandbox around native (e.g. Rust) code seems like a good idea, and it allows you to mix languages and opens other ecosystems.
- jfkebwjsbx 6y agoNo, it is not a good idea for backend where your processes and code are trusted because it does not come for free (it comes with a big performance penalty). Mixing languages does not require WASM in native code either. It has always been done through the C ABI.
- TomMarius 6y agoNo process nor code is trusted in my company. The performance penalty is negligible compared to the multi-million risks, and WASM execution can be optimized a lot as it goes past MVP. I don't know how to import a ES6 module using C ABI.