3 ms·
Because Rust’s generics are patterned after Haskell’s (traits are dual to type classes), not C++’ templates.
by masklinn 5y ago
Because Rust’s generics are patterned after Haskell’s (traits are dual to type classes), not C++’ templates.
- Diggsey 5y agoYou're conflating traits with generics. Generics exist without traits, and in Rust they are more closely aligned with C++ templates than anything else, since they are implemented via monomorphisation, whereas in Haskell they are not. Regardless, Rust is not "patterned" after a single other language. It's influenced by many langauges, so it makes no sense to say that one feature is just copied straight from a specific other language.