From: William Djaja Tjokroaminata Date: 2002-10-28T23:49:39+09:00 Subject: Re: Inheritance Problem in Dynamic/Typeless Language Hi Jim, Jim Weirich wrote: > The problem is retraining class writers (myself included) to > do it the right way. I don't think retraining will solve the vast existence of codes that have been written in the "old" way, including the basic Ruby built-in classes themselves. That's why I am very interested whether from OO design point of view, the current design is "flawed". (I think OO has been around for a long time, so it is hard to believe that this kind of problem is not encountered/solved before.) > This > problem has little to do with static vs dynamic typing and can easily > occur in C++ programs. Well, it may occur in C++ programs, but it is not the intention. Suppose derived a; parent b; parent c; .... a = b + c; Assuming that this code compiles and executes, here we are guaranteed that the class of a is "derived" (i.e., a will respond to methods that are defined for class derived). There may be some semantic/logic error depending on the overloadings of the '+' and '=' operators, but that is a separate issue. > On a side node (a mild rant) ... >> In a "typeless" language such as Ruby, > Ruby is hardly "typeless". It has all kinds of types. Types are a very > important part of programming in Ruby. (end of mild rant) Oh, I agree completely. I just use a terminology that apprently has been used very often here. I think the term "typed/typeless" is usually used to refer to the variables themselves, and not the objects. Regards, Bill