From: Ralph Mason Date: 2001-11-22T05:49:21+09:00 Subject: [ruby-talk:26073] Re: call_myself While I don't agree that call_self is of use. class X def fac(x) return 1 if x==0 x*call_self(x-1) end def call_self(y) caller[-2] =~/(\w*)'/ send($1,y) end end puts X.new().fac(4) It will be slow, but it will work. Ralph ----- Original Message ----- From: "Tobias Reif" To: "ruby-talk ML" Sent: Thursday, November 22, 2001 9:25 AM Subject: [ruby-talk:26067] Re: call_myself > David Alan Black wrote: > > > > I see what you're getting at, > > > good :) > > but I think that if there are so many > > lines of code in a method that you can't remember the method's name, > > it's probably time for some refactoring :-) > > > Yep, I know. I just think it would be very nice even for very short > methods: the recursing structure would be explained explicitly in the > code itself -> easier to understand. > > So again: who can implement call_myself in some lines of Ruby code? > > Tobi > -- > Tobias Reif > http://www.pinkjuice.com/myDigitalProfile.xhtml > > go_to('www.ruby-lang.org').get(ruby).play.create.have_fun > http://www.pinkjuice.com/ruby/ > >