4 ms·
> Saying that statically typed languages cannot be expressive is pure FUD. Could you, please, show us an example from the rosettacode.org website? Generic Quic
by dschiptsov 11y ago
> Saying that statically typed languages cannot be expressive is pure FUD.
Could you, please, show us an example from the rosettacode.org website? Generic Quicksort, perhaps?
- rubiquity 11y agoTake a look at OCaml, or any ML variant language (aside from Rust, which is more C++ than ML in my opinion anyway) for that matter, for a static typed language with a good implementation of generic types.
- adwn 11y agoWould you mind elaborating why you think that Rust doesn't have a good implementation of generic types?
- rubiquity 11y agoThe signatures can get really unwieldy compared to generics in other languages. As I understand it, the Rust team is working on this.
- pcwalton 11y agoI think you're comparing Rust to a language with ad-hoc polymorphism like C++ (where you pay for the somewhat simpler signatures with confusing template instantiation errors), and I'm very glad we didn't follow the C++ route. Rust's generics are very similar to those of Haskell. The only major generics-related issue that is getting some significant thought is the ability to have the automatically derive the return type on top-level functions, which is not something that is common in other statically typed languages (only C++ and those with whole program type inference, which has its own set of drawbacks).
- dschiptsov 11y agoI took the Dan Grossman's PL course, so I appreciate how good Standard ML is.)
- the_why_of_y 11y agoNo idea what you're looking for, but just for the record: import List(partition) qs [] = [] qs (pivot:rest) = qs smaller ++ pivot : qs larger where (smaller,larger) = partition (< pivot) rest Haskell 98, the (polymorphic) type is "Ord a => [a] -> [a]"
- dschiptsov 11y agoHaskell is an exception. Haskell is two distinct languages in one - one for defining types, and one for expressions.)