From: Phrogz Date: 2007-01-13T01:40:06+09:00 Subject: Re: Why doesn't Ruby allow for overloaded methods within a class Wes Gamble wrote: > I've done quite a bit of googling and read a bunch of posts about this, > but I'm looking for a simple explanation of why Ruby doesn't support > method overloading within a class to allow methods with the same name > but different numbers of arguments. In my mind, this makes sense in a statically-typed language. The signature of the method is reasonably clear in that case. "If I pass an array, do A; if I pass a Vector, do B; if I pass a number, do C; if I pass an array and a number, do D." It seems like a very floppy, weak signature to change behavior just on the *number* of arguments. "If I pass one thing...uhm...well, I guess it depends on what that one thing is internally, so I'll have to branch inside. If I pass two things...it's different from one things, but again, it depends on which two things are passed in." You'd end up mixing your operation determination between automatic method choosing and between code that you have to write anyhow inside the methods.