From: Mauricio Fernandez Date: 2007-10-09T06:20:02+09:00 Subject: Re: The Case for Multiple-Inheritance On Tue, Oct 09, 2007 at 02:00:05AM +0900, Rick DeNatale wrote: [...] > In Java/C++ inheritance is primarily a means of expressing type > relationships, and secondarily a means of sharing implementation. > Because of the statically typed nature of these languages, related > types HAVE to be related by inheritance. [...] > In a statically typed language the coupling of type specification with > implementation leads to a particular set of pressures on the design of > both the language and programs in that language which are different > from the pressures on Ruby and it's programs. This is getting OT, but I just wanted to clarify that not all the languages with a statically typed OO system confound subclassing and subtyping the way C++ and Java do. In OCaml, for instance, two unrelated classes can represent the same type, and a class might not be a subtype of its parent(s). In fact, you can get what amounts to a sort of duck-typing, with the guarantee that there will never be a "NoMethodError". If in Ruby you have def foo(x); x.bar end in OCaml let foo x = x#bar and the foo function will work on any object with a 'bar' method, regardless of the class (there are also "immediate objects"). The existence of that method is checked statically. -- Mauricio Fernandez - http://eigenclass.org