On 04/27/2010 06:55 AM, Steve Schveighoffer wrote:
Following the example in the book, let's say I make my own widget, called StevesTextWidget, which inherits Widget, not TextWidget. It has some of the same functionality as TextWidget, but it's not a TextWidget. If I want to be able to compare StevesTextWidget to a TextWidget, it's not possible, because the TextWidget will veto every time, even though StevesTextWidget has total understanding of TextWidget and can correctly do the comparison. On the other hand, if || was used, comparing StevesTextWidget to a Widget will allow Widget's routine to override the opEquals of StevesTextWidget, and like the example in the book, could possibly cause an invalid equal response.
Let's suppose we allow the feature above. Then a StevesTextWidget can claim equality with a TextWidget in spite of the latter's opposition. But then a WaltersTextWidget could also claim equality with the same TextWidget, again in spite of the latter's opposition. But then StevesTextWidget may not compare equal with WaltersTextWidget, which would break transitivity.
Andrei _______________________________________________ phobos mailing list [email protected] http://lists.puremagic.com/mailman/listinfo/phobos
