> I don't think this is true. Anyone who can see both the type and the type
> class visible can declare an instance. This is very convenient and something
> that should be retained in a potential Rust version, IMO.

I indeed can't find anything about this in a quick scanning of the
standard. Maybe it's another language that does it this way, or maybe
I'm just completely making things up here. Declaring instances
anywhere is a gain in expressiveness, but does lead to the unsavory
possibility of clashes, when linking stuff together that declares two
different instances for a type/class pair. (I also assumed this would
lead to not being able to determine which instance to use statically,
but actually that's not much of a problem--it'd just be a compile-time
error to use a value of type X where class Y was expected unless the
compiler can see that X was declared instance of Y somewhere in the
linked libraries.)
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to