On 2005 Jan 12, at 20:39, Phillip J. Eby wrote: ...
> it's difficult because intuitively an interface defines a *requirement*, so
> it seems logical to inherit from an interface in order to add requirements!


Yes... I would fall into this trap as well until I'd been burned a few times.

It's burned me more than just a few times, and I *still* sometimes make it if I'm not paying attention. It's just too easy to make the mistake. So, I'm actually open to considering dropping interface inheritance.

What about accepting Microsoft's QueryInterface precedent for this? I know that "MS" is a dirty word to many, but I did like much of what they did in COM, personally. The QI precedent would be: you can inherit interface from interface, but that does NOT intrinsically imply substitutability -- it just means the inheriting interface has all the methods of the one being subclassed, with the same signatures, without having to do a nasty copy-and-paste. Of course, one presumably could use NO_ADAPTER_NEEDED to easily (but explicitly: that makes a difference!) implement the common case in which the inheriting interface DOES want to assert that it's perfectly / losslessly / etc substitutable for the one being inherited.



Alex

_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to