3 ms·
Traits are typeclasses :) Uh, the coherence rules are complicated and I forgot them. It's a mixture of where the impl, type, trait, and type parameters are.
by Manishearth 11y ago
Traits are typeclasses :)
Uh, the coherence rules are complicated and I forgot them. It's a mixture of where the impl, type, trait, and type parameters are.
- jroesch 11y agoThe general the coherence rules stop you from defining an implementation that could be possibly defined elsewhere. The important take away implications are: - you can not implement a trait defined in another crate for a type defined in another crate, unless the trait is parametrized by a type from the current crate - you can't define overlapping implementations
- jamii 11y agoSo the coherence rules don't treat self specially? That would be good to know.