4 ms·
I think Rust's features were actually inspired by OCaml rather than Haskell. Rust was originally written in OCaml, and OCaml feels a lot more similar to Rust th
by IshKebab 4y ago
I think Rust's features were actually inspired by OCaml rather than Haskell. Rust was originally written in OCaml, and OCaml feels a lot more similar to Rust than Haskell does.
Of course Haskell is heavily influenced by ML so it also has a lot of the same features.
- erk__ 4y agoThere does exist at least one sml implementation that computes the memory allocations at compile time a bit similar to how Rust does it.
- jeremyjh 4y agoTraits are definitely inspired by Haskell typeclasses (according to Graydon), but you are right that many other similarities are also shared with ML languages.
- maxiepoo 4y agoIt doesn't have to be one or the other :). OCaml and Haskell are two great languages that the Rust designers were familiar with. The big thing IMO that makes Rust feel like Haskell is the pervasive use of traits and `#[derive(...)]` which is directly analogous to the pervasive use of typeclasses and `deriving` in Haskell.
- wyager 4y ago> I think Rust's features were actually inspired by OCaml rather than Haskell The old alpha/beta rust docs specifically referenced Haskell all over the place, and I don't recall them mentioning OCaml. > OCaml feels a lot more similar to Rust than Haskell does I disagree very strongly with this. OCaml doesn't even have type classes/traits! Rust lacks polymorphic variants, functorial modules, etc. It's really nothing like idiomatic ocaml, whereas I think it's pretty reasonable to describe Rust as "what Haskell devs would make if they weren't allowed to heap allocate". Maybe they'd also add a few more gizmos to the type system :)
- deleted 4y ago[deleted]