3 ms·
It's actually correcting the mistakes of C++: - Ownership: means no unsafely shared mutable state, checked at compile time with no runtime overhead. Also, no e
by bascule 13y ago
It's actually correcting the mistakes of C++:
- Ownership: means no unsafely shared mutable state, checked at compile time with no runtime overhead. Also, no explicit deallocations!
- A real type system: Rust's type system is inspired by the Hindley-Milner type inference algorithm used in languages like ML and Haskell
- TylerE 13y agoThe thing is I've used lots of languages with full H-M inference that are much less complicated than this.
- olsonjeffery 13y ago> lots of languages with full H-M inference These are the ones that come to my mind: - ML family (Standard ML, Caml, OCaml, F#) - Haskell None of these are competing in the same space as Rust: fine-grained memory control (read: perf on par w/ C++) with zero-cost abstractions for safety. You can certainly argue that all of those languages are as safe as Rust, with the lack of nulls and explicit mutability (taken to a new level in Haskel), but you can't say they expose a memory models that actually reflects the underlying system (and are as tunable) to the extent that Rust does.
- tel 13y agoRust implements a kind of region typing or linear logic, too, right? That's significantly beyond anything you'll see in garden variety Haskell/ML (though you can embed linear logic in the Haskell type-class machinery with a final encoding [0]). [0] http://okmij.org/ftp/tagless-final/course/#linear http://okmij.org/ftp/tagless-final/course/#linear
- pcwalton 13y agoYes to both. Lifetimes are basically regions, and unique types are basically affine types. (We usually stick to the C++ terminology, though, for familiarity's sake.)
- pjmlp 13y agoAlthough OS research is being done with OCaml by Xen Foundation and Cisco http://www.openmirage.org/ http://www.openmirage.org/
- banachtarski 13y agoThere's already plenty of people talking out of their asses here. No need to add to it.
- mcguire 13y agoThis is true. However, Rust is intended to be a systems language, which among other things means no, or at most optional, garbage collection and types for unboxed values. Like Java generics and subtyping, any given part may be simple on its own, but the combination is not. Rust tracks lifetimes for stack- and dynamically-allocated values as part of the type system; hence "owned" pointers. Which are horrible by themselves; hence "borrowed" pointers and the resulting lifetime complications. Rust includes traits, which are similar to Haskell type classes and are very nice. However, they come with a heapin' helping of their own complexity. And so forth. Rust is aiming for a sweet spot somewhere between a relatively-simple Hindley-Milner[-Damas] parametric polymorphism and full-on dependent typing. So far, I think it hits a pretty nice local optimum.