On Nov 28, 2011, at 12:38 AM, Marijn Haverbeke wrote:

> I prefer them because they enforce a much more structured way of
> thinking. Declaring grab-bags of methods and assembling them into
> interfaces ad-hoc seems clumsy and, as you mention, error prone ---
> just because a method has a given name, doesn't mean it actually does
> the same thing as other methods by that name. Explicitly declaring
> what interface you're implementing would remove this vagueness.

It makes sense to have nominal interfaces, but being too strict about requiring 
explicit implementation declarations has a well-known modularity issue: if you 
use a third-party library that does not declare that it implements a particular 
interface, there's no way to declare that it does without changing the 
third-party library's code. This comes up in two ways:

1) classes that don't explicitly declare they implement an interface
2) interfaces that don't explicit declare they extend an interface

We should *allow* explicit declaration of interface implementation, but we 
should consider being less strict than Java about requiring these declarations.

Dave

_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to