From: ara.t.howard@... Date: 2006-09-09T00:20:51+09:00 Subject: Re: [CHALLENGE] better alias_method On Fri, 8 Sep 2006, Ken Bloom wrote: > On Fri, 08 Sep 2006 14:34:39 +0900, ara.t.howard wrote: > >> i've been wanting a better alias_method for quite some time. essentially i'd >> like a way out of the trap where executing >> >> alias_method '__fubar__', 'fubar' >> >> goes haywire when __fubar__ already exists. we've all seen it happen before. >> >> anyhow. the interface it'd like would be > > It would be nice to have this built in to the language -- a way to blur the > difference between overriding an inherited method and overriding a method > defined on the current class, so that `super' would call whatever the > previous version of the was. > > Try this idea on for size. I wrote it a few days ago. Look at the unit > tests at the end to see how it's intended to be used. I think a little > syntactic sugar would be nice, but it gets the job done. the show stopper for me is the fact that define_method cannot define methods that take blocks - so your approach loses them during the alias process. i remember that define_method will soon have the ability to define methods that take blocks do you know if that's in 1.8.5 or the 1.9 branch? cheers. -a -- what science finds to be nonexistent, we must accept as nonexistent; but what science merely does not find is a completely different matter... it is quite clear that there are many, many mysterious things. - h.h. the 14th dalai lama