From: Erwan David Date: 2001-08-16T19:14:07+09:00 Subject: [ruby-talk:19883] Re: Why not?: Assigning to self matz@ruby-lang.org (Yukihiro Matsumoto) writes: > Hi, > > In message "[ruby-talk:19867] Re: Why not?: Assigning to self" > on 01/08/16, "Pit Capitain" writes: > > |Take the famous Shape class hierarchy: > | > |class Shape; ...; end > |class Rectangle < Shape; ...; end > |class Square < Rectangle; ...; end > | > |Suppose you have a Rectangle instance and use one of its resizing > |methods so that the new height equals the new width. After that it > |would be nice if the Object had become a Square instance. > > I feel you're relying too much on inheritance hierarchy. In Ruby, > it's at best implementation sharing. Well that's seems not to me inheritance for me, but definition by constraints... And I do not know any language implementing this... (IE defining that a square is a rectangle which verifies the constraint that width = heigth). -- > Quant � ma mauvaise quote de mail , d�sol�, c'est Outlook qui coupe tout > seul � 76. (pour ton r�pertoire de neuneuX, si tu veux) > (comme les lignes font d�j� 76, avec les quotes, forc�ment, �� d�passe) -+- C in: Guide du Neuneu d'Usenet - Quand les bornes sont franchies -+-