Re:Diminishing returns of static typing
by nicoburns on Monday October 02, 2017 @06:32PM
(#15388544)
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.
This allows you implement patterns like duck typing which are idiomatic in languages like javascript, but impossible to implement in java.