News for hackers. Stuff that matters.
Re:A Python Interpreter Written in Rust by nicoburns on Saturday February 02, 2019 @01:05PM (#19064532)
Rust is particularly suited to WASM due to the lack of GC and runtime (which tend to be quite large, and have to be downloaded in a web context). And due to it being able to achieve very high performance (which is the whole point of WASM). The only other languages that really compete here are C and C++, and they don't have the great, easily installable library ecosystem that Rust has, and they aren't very accessible to JavaScript developers).

Personally I'm more excited about other uses of Rust, but I can see why people are excited about Rust and WASM.

Re:A Python Interpreter Written in Rust by mhh__ on Saturday February 02, 2019 @05:49PM (#19066290)
You're talking about web technologies, and needing to download a runtime is the problem?

C++ isn't accessible but rust is? Only because they can't be bothered to learn: It complicated but its really not that hard.

Plug: D can happily compile to wasm

Re:A Python Interpreter Written in Rust by nicoburns on Sunday February 03, 2019 @08:00AM (#19069345)
Well yes, the need to download a new runtime for every app you run is a problem if thst runtime is several megabytes.

C++ isn't accessible to web developers compared to Rust. It's not just that I can't be bothered to learn, it's that I'm scared of all the security vunerabilities and memory corruption bugs I will write while I'm learning. And wjy put in that effort when I can learn Rust more easily, and get the ongoing benefits of my code being safe and reliable.

True, D also competes here. I should probably have put D on the list. Although my understanding is that a large part of the D ecosystem still relies on GC.

Re:A Python Interpreter Written in Rust by mhh__ on Sunday February 03, 2019 @01:41PM (#19071331)
Most runtimes are fairly small, and most issues could be done away with by either the browser storing common runtimes (Search for x, then checking hashes etc.) or by compiling statically against the parts you actually use.

This is still not conclusive, as the runtimes will probably have to be significantly modified (at the ABI/System level, so around the edges) given that they will have to get memory from the browser etc. This leaves much room for WASM specific optimisation, especially given that the actual (let's say) garbage collector implementation is probably quite small compared to the code used to interface to it.

Writing C++ defensively (i.e. Do what the guidelines tell you, Preach Andrei and Bjarne etc), and using sanitizers cleans up a huge amount of C++ code.

Re:A Python Interpreter Written in Rust by nicoburns on Sunday February 03, 2019 @03:43PM (#19072059)
> Writing C++ defensively (i.e. Do what the guidelines tell you, Preach Andrei and Bjarne etc), and using sanitizers cleans up a huge amount of C++ code.

Well sure, but the joy of Rust is that I don't have to worry about any of that. I can write my code naively, and the compiler will throw an error if I do anything stupid.

> This is still not conclusive, as the runtimes will probably have to be significantly modified (at the ABI/System level, so around the edges) given that they will have to get memory from the browser etc. This leaves much room for WASM specific optimisation

Certainly if/when this happens, other languages will be a lot viable in the compile-to-wasm. But you can run Rust (and C/C++) in the WASM runtime without issues today. And Rust even has a number of high-level libraries which provide binding to JavaScript APIs (e.g. https://github.com/rustwasm/wasm-bindgen)

Re:A Python Interpreter Written in Rust by aaaaaaaaaaab on Saturday February 02, 2019 @07:16PM (#19066839)
>they aren't very accessible to JavaScript developers

I wonder how Rust is more “accessible” to JS developers than C or even C++. If you find C too hard to comprehend, you’re definitely not ready for Rust...

Re:A Python Interpreter Written in Rust by nicoburns on Sunday February 03, 2019 @08:08AM (#19069375)
As someone who learnt Rust after trying to learn C, I disagree. Basic C is easy. I could write a data structure. But as soon as you want to do anything useful, like parse command line arguments or use open gl, C becomes much more complicated.

Rust code is actually pretty similar to JavaScript code, in that I can pull in a library `cargo add regex`, and work with high level abstraction right away.

Of course, there are new concepts to learn, but the Rust book covers these pretty well (I've been unable to find similar documentation for C/C++ that doesn't run to hundreds of pages).

My observation is that many people learn C/C++ at university (where there is lot's of support for learning the arcane folk knowledge of "the right way" of doing things in those langauges), and subsequently find Rust hard, because it introduces new concepts, and doesn't work in the same vein as C/C++.

For those of us coming from higher level languages, Rust is much easier, because it provides guard rails and prompts us when we go wrong, and because once a few new concepts have been learnt, a lot of our existing concepts can still be applied.