Revisit Orphan Rules

afaik, in every other language the list of traits/interfaces that everyone is expected to provide implementations for is basically the same as Rust: something to stringify the type for logs, something to serialize the type for persistent storage, and value type semantics like equality and ordering when applicable. For every other interface, the assumption was that you'll use inheritance/wrapper types if you really need it.

I think the only meaningful difference between Rust and Java/C# here is that Rust's Serialize trait is not part of the core language or standard library, which I suspect is one of the reasons this might feel like a much bigger problem than it did in those two languages: Java/C# never really had an interface in a 3rd party library that "everyone should implement".

But I don't think that automatically means Rust's list of 3rd party traits that everyone needs to implement is likely to grow in the future; I still think that serialization is special and it's unlikely we'll ever need to make such a recommendation for anything else.

1 Like