From: Rick DeNatale Date: 2006-09-26T06:48:03+09:00 Subject: Re: How to copy a method from one class to another On 9/25/06, Sam Kong wrote: > > I think you're understanding my problem very correctly. > My need was sort of like multiple inheritance which is not supported in > Ruby. And even in a language like C++ which supports multiple inheritance, you can't pick and choose which functions you inherit. In fact, it's even harder because, unlike a dynamic language like Ruby, where inheritance and mix-in is used only to compose implementation, in a strongly typed language they also are the mechanism of type composition. It's this tight-coupling of implementation and specification which distinguishes the two approaches. And it's one good reason why Ruby is NOT C++, nor is it Java, and one of the reasons so many things seem to be easier in Ruby once you get acclimatized. > Mix-in is the right way in Ruby. > However, for mix-in, all things should be designed before > implementation. Not necessarily before, but in concert with, it's called iterative design, the design evolves as you learn more about the problem by implementing it. Another difference in the strongly typed vs. dynamic languages is the implications of refactoring. In a dynamic language it's more like rearranging furniture, while in a strongly-type one it's more like solving a 15-puzzle. -- Rick DeNatale My blog on Ruby http://talklikeaduck.denhaven2.com/