TLDR Web Dev · MISCELLANEOUS
TRAITS ARE A LOCAL MAXIMA
Summary from the TLDR Web Dev newsletter
Rust's traits, while popular, suffer from the "orphan instance problem," where implementing a trait for a type from a different crate is restricted. This leads to potential coherence issues. A possible solution is local coherence using implicits. While implicits address the orphan instance problem, they introduce new challenges, including increased code repetition, potential loss of correctness guarantees, and reduced code readability compared to traits. Both traits and implicits represent local maxima in language design, but each have their own trade-offs.