From: gotoken@... (GOTO Kentaro) Date: 1999-07-09T05:15:25+09:00 Subject: [ruby-talk:00436] redefinition and alias (Re: New feature for Ruby?) In message "[ruby-talk:00434] Re: New feature for Ruby?" on 99/07/08, Clemens Hintze writes: >Woah! T h a t i s w o n d e r f u l !!! :-))))))))))))))))) > >I didn't know, that this is possible... I did know concerning >Singleton methods... but this... How unhappy you were!! But I'm sorry I also don't know where it is documented... Some bundled libraries use this feature (e.g., complex.rb, expect.rb). >But does that mean, I cannot redefine an already defined class? I think that completely redefining is impossible. >PS: Would it makes sense to introduce that feature in the >Ruby-Manual? Perhaps it is, but I cannot remember I did see that! >Furthermore please explain `alias' more a little bit. I could not see >from the manual, whether the syntax is `alias old new' or `alias new >old'. Like a shell, `alias new old'. `alias' is also useful to modify a method: class Array alias ref [] private :ref def [](*ind) ind.collect{|i| ref(i)} end end eto = [:ne,:ushi,:tora,:u,:tatsu,:mi,:uma,:hitsuzi,:saru,:tori,:inu,:i] p eto[2,5,6,10].filter{|i| i.id2name} #=> ["tora", "mi", "uma", "inu"] HTH # I'll reply again to discuss about Range. -- gotoken