From: David Alan Black Date: 2002-04-12T21:50:38+09:00 Subject: Re: Idea for a new shorthand Hi -- On Fri, 12 Apr 2002, Hal E. Fulton wrote: > Do you see where I'm going? I propose a special > name "prior" that will automatically refer to the > prior definition of any method that is being replaced. > No aliases will be necessary. > > def system_method > if today == Sunday > # Do some stuff... > end > prior > end > > What do you think? I've always thought of super as a Y-axis thing, and alias as an X-axis thing. I'm not sure whether they can be combined into one thing, without some loss. Here's a rather contrived example: class Thing < String alias :oldsplit :split def split(*sep) puts "New split" oldsplit(*sep) end end class Thing alias :othersplit :split def split(*sep) line = gets if /o/.match(line) othersplit(*sep) else super end end end str = Thing.new("this is a string") p str.split I'm not sure how you could replace both super and alias with prior, and still be able to do this kind of perpendicular branching (either up the hierarchy, or sideways to the aliased "sibling" method). David -- David Alan Black home: dblack@candle.superlink.net work: blackdav@shu.edu Web: http://pirate.shu.edu/~blackdav