Rust-1.7
http://blog.rust-lang.org/2016/03/02/Rust-1.7.html
- Library stabilisation.
- HashMap : SipHash algorithm + FNV hash algorithm
- Cargo minor changes
Java vs Rust
https://llogiq.github.io/2016/02/28/java-rust.html
- History
- Runtime
- just in time (JIT) compilation in JVM -> profile based optimisation
- Rust - is fast, but could be slower, depends on you :)
- in Rust - orders of magnitude less memory
- Java GC is very optimized -> painless programming.
- you can write complex code to use less memory.
- Rust has zero-sized runtime
- Rust is compiled language -> less portable. But LLVM -> easier to support many architectures
- lifetime- and ownership- rules: headache and help
- Types:
- Java’s primitive type are a subset of Rust’s
- Java: integral operations are wrapping (no overflow check).
- Rust: integral operations are checked in debug, wrapping in release.
- Rust has tuple
- Rust and Java keep generics to compile time
- Rust type system is more mightier, turing capable. Uses generics to communicate lifetime information
- Java: null
- Java: automatic widening coercion: int -> long
- Rust has only ‘deref coercion’. Code is easy to understand and predict the type.
- Rust’s immutability by default
- it may be harder to write Rust code than Java code
- it’s a lot harder to write incorrect Rust code than incorrect Java code
- “compiles -> will work”
- Java has Class, Rust has Trait
- in Rust you think about data at first, then about behaviour
- Destructing pattern matching in Rust
- Functions and Closures
- Java has lambdas. Rust too (can modify captured env if ownership allows)
- Java streams offer a low-code way to data-parallelise computations
- Rust doesn’t, but has 3d-party libs
- Java dispatches functions based on argument types. Mangling
- Rust: the same set of arguments + generics some_fun<S: Into>(s: S)