3 ms·
As someone who's been in the system programming space for a while and played with Rust for ~1.5 years here's my highlights. 1. I haven't written any multithrea
by vvanders 10y ago
As someone who's been in the system programming space for a while and played with Rust for ~1.5 years here's my highlights.
1. I haven't written any multithreading code yet but I love the borrow-checker since it does a fantastic job of dealing with mutable state. I find I get better architected programs with single-ownership long before I start writing Rust and I love to see the compiler enforce it.
2. ADTs. Simply the best way to represent State + Data bar none. Combine with pattern matching and it's just sublime.
3. Iterators. Never seen a language do them so well with so little overhead. The focus on zero-cost abstractions really shines here.
4. Cross platform support. This is a huge one. Having dealt with MSCV/GCC/LLVM/custom compiler toolchains I can't stress to wonderful it is to have a consistent compiler that can build other targets on a different host.
5. Cargo, other people have covered it, enough said.
6. The community. Truly one of the better ones out there who not only want to help but also provides releases like clockwork with clear semantics on stability and APIs.
- nialv7 10y ago> 3. Iterators. Never seen a language do them so well with so little overhead. The focus on zero-cost abstractions really shines here. Try some D, maybe? :)
- vvanders 10y agoHaven't had a chance to play with D yet but a quick perusal shows quite a few things missing from their iterator lib(zip, enumerate, cycle, collect). I probably just need to spend some time with it at some point. That said the examples look much close to Rust than C++11(seriously did they think through how painful std::transform() is with all the begin/end pairs?). One thing that not a lot of people know is you can iterate over a Result<T,E> and collect::<Result<Vec<T>, E>>() which is a really elegant way to bail on a single error or get a collection of values.
- nialv7 10y agoD does have zip, enumerate, cycle (https://dlang.org/phobos/std_range.html https://dlang.org/phobos/std_range.html). It doesn't have a universal collect like Rust, but you can create arrays from ranges using array(). And if the target container/collection type is an OutputRange, you can use the put()(https://dlang.org/phobos/std_range_primitives.html#.put https://dlang.org/phobos/std_range_primitives.html#.put) function to create collections from ranges.
- Manishearth 10y agoFWIW that the borrow checker has nothing to do with multithreading, all the guarantees enforced are important in single threaded contexts. http://manishearth.github.io/blog/2015/05/17/the-problem-with-shared-mutability/ http://manishearth.github.io/blog/2015/05/17/the-problem-wit... It's a prerequisite for safe scoped multithreading, but that's about it.
- vvanders 10y agoFair enough, it's a common enough refrain that I wanted to point out specifically that there's lots of benefits to it outside of memory safety.