My memory is bad but I’m pretty sure there have already been some discussions (and perhaps rfcs) about opt-in implementations. The fact is this feature have certainly received other names. Consequently I cannot find very relevant information when looking in the past posts/rfcs using my own terminology.
What I mean by “opt-in implementations” would be the possibility to create an implementation
I of a trait
X for a type
Y outside both the crates of
Y but with the additional constraint one would have to explicitly opt-in this implementation where needed. I believe one of the major reproaches was it would allow a category of subtle bugs (for example creating some code where a single piece of data is modified by two incompatible implementations of the same trait). I would like to plunge back into these discussions. Does that ring a bell?
More generally is there currently any consensus on the best solution to solve the issue described above? If you want to use type
Y and you need an implementation of trait
Y come from two completely independent crates you don’t own, what are your options? I suppose newtypes are a possibility but they imply a certain amount of boilerplate.