From: gotoken@... (GOTO Kentaro) Date: 2001-01-22T10:42:38+09:00 Subject: [ruby-talk:9693] Re: new and initialize - In message "[ruby-talk:9688] new and initialize -" on 01/01/22, "g forever" writes: >I am not suggesting a change but I am curious why languages including Ruby >do not use new as a class method Simple reason: there isn't an instance before that is created by `new'. >e.g. >class Test >etc. >def new(x) >@z= x; >end > >etc. >end > >mytest= Test.new > > >instead of 'initalize' > >Is there some fundamental reason why the latter is the way to do it. As you wrote, `new' is sent to Test class (Test.new), but not Test object (aTest.new). Btw, every Ruby's method invocation can be written by send like, reciever.send(symbol, *args) e.g., t = Test.send(:new, "foo") t.send(:z) -- Gotoken