4 ms·
True, but there are more elegant solutions. For example, Rust's traits allow you to define a trait (somewhere in between an interface and an abstract class in J
by nicoburns 9y ago
True, but there are more elegant solutions. For example, Rust's traits allow you to define a trait (somewhere in between an interface and an abstract class in Java), and then methods can be generic over any object that implements that trait. And structs and traits have a many-to-many relationship.
This allows you implement patterns like duck typing which are idiomatic in languages like javascript, but impossible to implement in java.