|
|
|
|
|
by roca
2330 days ago
|
|
I think most people would rate Rust as being closer to Haskell than Java at the type level. Rust traits are very much like Haskell type classes. Java gives you classic OOP, but neither Rust nor Haskell do. Rust generics are much more like Haskell generics than Java generics. Rust and Haskell both have associated types, Java doesn't. Java generics are crippled due to type erasure; Rust and Haskell don't have those limitations. Rust and Haskell generics support a lot of type-level computation; Java doesn't. Rust and Haskell don't have ubiquitous nullable-by-default values; Java does. Rust and Haskell have discriminated sum types; Java doesn't. The only way I think Rust is more like Java than Haskell at the type level is that Haskell has higher-kinded types and Rust/Java don't. There are plans to fix this in Rust though. |
|
Both Rusk and Haskell erase types at runtime. The difference is they don't rely on runtime reflection for anything, so it doesn't hurt them.