From: Pit Capitain Date: 2001-08-16T20:41:11+09:00 Subject: [ruby-talk:19887] Re: Why not?: Assigning to self On 16 Aug 2001, at 19:14, Erwan David wrote: > matz@ruby-lang.org (Yukihiro Matsumoto) writes: > > > 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 > > > > 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). Searching the web for something like rectangle/become/square I found a language called cecil, that has so called predicate subclasses, which seem to offer this functionality. See http://www.cs.washington.edu/research/projects/cecil/cecil/www/ce cil-home.html Regards, Pit