From: "Peña, Botp" Date: 2007-01-12T18:55:52+09:00 Subject: Re: Why doesn't Ruby allow for overloaded methods within a class On Behalf Of Wes Gamble: # Here's an example of what I mean: # class Foo # def methname(x,y) # ... # end # # def methname(x, y, z) # ... # end # end # ... # But it seems like this kind method overloading would be # doable in Ruby. # Is it possible? Hi Wes, from my nuby experience, no. what would you expect ruby to do if you have class A def a end end class A def a b end end ? you'd want ruby to create two methods of same name "a" but w diff params, no? BUT, what if i really want to change method "a", and want it to receive 2 params among other things? "but what if i want to retain the old "a"? ", you might ask. No problem, you can give it a different name by alias-ing it, eg, old_a. It is easier for me to remember names than remember different params and their combinations/positioning thereof. also, ruby allows this def a *b end is that one or multi params? (btw, you may not see the block param. it's magic) :) ergo, ruby does method "dynamic reloading" and loads w whatever changes it carries w its load. it's just a term i learn from "the matrix" :) # Is it not available because there's a feeling that it isn't needed? ruby is object oriented (not method oriented) eg, string.length, array.length, hash.length etc. Note, no change name there (only change in objects) and they may have diff params, too. One method name to remember, easy for my brain. maybe you can provide an example where you need method overloading? kind regards -botp