C++/Java/C#: The closest analogue to traits is interfaces and/or abstract base classes, which must be part of a type's definition, so there's simply no such thing as "orphan impls".
Haskell: Orphan impls are allowed, and you simply get an error if you ever import incoherent impls. GHC does have an IncoherentInstances language extension that permits GHC to do magic to select an impl for you, but no one should ever use that.
Obviously, this is very incomplete. Please comment if you're familiar with how any other language handles these problems
C++/Java/C#: The closest analogue to traits is interfaces and/or abstract base classes, which must be part of a type's definition, so there's simply no such thing as "orphan impls".
Haskell: Orphan impls are allowed, and you simply get an error if you ever import incoherent impls. GHC does have an
IncoherentInstanceslanguage extension that permits GHC to do magic to select an impl for you, but no one should ever use that.Obviously, this is very incomplete. Please comment if you're familiar with how any other language handles these problems