Re:State of Multicore OCaml [pdf]
by tbenst on Thursday June 28, 2018 @12:26PM
(#17418279)
I’m not sure where your perception is coming from. Rust and Scala are more functional than they are OOP. Rust for example uses Hindley-Milner type inference, putting it squarely in the functional camp. And Scala is highly functional as well, considering its use of higher order functions and monads.
[ Parent
| on HN ]
Re:State of Multicore OCaml [pdf]
by tom_mellior on Thursday June 28, 2018 @12:37PM
(#17418386)
> Rust for example uses Hindley-Milner type inference, putting it squarely in the functional camp.
That's not a very good way to characterize functional programming languages. Obviously you can do functional programming without type inference (see Lisp), and type inference is similarly applicable to non-functional languages (see OCaml's purely imperative sublanguage).
Also, as far as I can tell, Rust uses (a modification of) the Hindley-Milner algorithm to infer lifetimes, not types. As languages in the functional camp typically don't have lifetimes, this argument is a bit strange.
Rust uses Hindley-Milner to infer types in general, but there is a conscious decision to require explicit types in function signatures etc. Also, lifetimes are part of all rust's types, they are just usually elided since it would be pretty verbose and unhelpful to always write them out.
Re:State of Multicore OCaml [pdf]
by tom_mellior on Friday June 29, 2018 @08:30AM
(#17424094)
> Rust uses Hindley-Milner to infer types in general
True, I had forgotten that you can just write let foo = bar. (Not a regular Rust user.)
By reference to HM, I mean to illustrate that Rust has fundamental similarities to the typed lambda calculus, which has been done more formally by Rust Belt. Additionally, traits in rust are highly similar to type classes in, say, Haskell. Describing rust as a functional language is reasonable, see eg http://science.raphael.poss.name/rust-for-functional-program...