News for hackers. Stuff that matters.
Re:Xi editor: A modern editor with a backend written in Rust by kingosticks on Wednesday April 27, 2016 @05:24AM (#11578878)
I've no exposure to Rust but is it accurate to compare it to C++ as offering a much more reliable, and in many ways, higher level programming platform.

Are there some quick and simple examples of this?

Re:Xi editor: A modern editor with a backend written in Rust by kimundi on Wednesday April 27, 2016 @07:32AM (#11579424)
I don't have concrete examples, but in general:

For one, the build system/dependency system is much more easier to handle. Rust uses the cargo package manager, and depending on an external library is as simple as adding a single line to the Cargo.toml config file. Likewise, building, running, documenting and testing is all a build-in matter of calling `cargo [build|run|doc|test]`, which makes prototyping and getting started way easier than my experiences with C++ so far.

As far as the actual language goes it basically behaves like C++ and has a similar feature set, so you get the same sense of how given source code will end up in the compiled binary, and can write fast efficient code with, for example, features like pointers. The big distinction there is that Rust is memory safe per default, (including pointers in form of safe references) and upholds this invariant with compiletime checks and explicit language barriers (needing to encapsulate "unsafe" operations in unsafe {} blocks), so per default you are protected from whole classes of bugs that are possible in C++, like dangling pointers, memory races, iterator invalidation, etc.

Re:Xi editor: A modern editor with a backend written in Rust by Cyph0n on Wednesday April 27, 2016 @06:21AM (#11579144)
The main advantage is Rust's ownership model. It allows you to catch most memory problems at compile time.

https://doc.rust-lang.org/book/ownership.html

Re:Xi editor: A modern editor with a backend written in Rust by akadien on Wednesday April 27, 2016 @07:44AM (#11579492)
And it's one of the languages features that has a very steep learning curve. Rust forces your design into its model.

Interestingly, rustc also seems to generate programs that leak memory. I recall an issue where the simple and venerable "hello world" program in Rust (i.e., println!) had memory leaks.

Re:Xi editor: A modern editor with a backend written in Rust by steveklabnik on Wednesday April 27, 2016 @09:06AM (#11579998)
That shouldn't be true. Please file bugs!
Re:Xi editor: A modern editor with a backend written in Rust by akadien on Wednesday April 27, 2016 @09:07AM (#11580015)
Re:Xi editor: A modern editor with a backend written in Rust by steveklabnik on Wednesday April 27, 2016 @10:03AM (#11580498)
Great, thanks.