From: Jamis Buck Date: 2003-12-24T00:28:53+09:00 Subject: Re: Copying methods from one class to another Ian Hobson wrote: > This still does not answer the question of why? (At least for me), so > I'm jumping in here are asking it again! > > When you can simply extend class A with any new method you need, why > do you want to create a subclass and pretend it is the class you > started with? > > Regards > > Ian > Well, I'm not really the right one to answer this, but I'll try. My understanding is that they are trying to implement method wrappers (the whole AOP thing) using existing Ruby features (whereas matz's slides about Rite indicate a new syntax for method wrappers). One of the things they are investigating is subclassing as a way of wrapping methods. It's a clever trick, and if it were possible to copy methods from one class to another it might actually work. However, it looks like you can't do it this way. Those who are "in the know", please correct me if I've terribly misstated anything... -- Jamis Buck jgb3@email.byu.edu ruby -h | ruby -e 'a=[];readlines.join.scan(/-(.)\[e|Kk(\S*)|le.l(..)e|#!(\S*)/) {|r| a << r.compact.first };puts "\n>#{a.join(%q/ /)}<\n\n"'