Patrick Logan <patrickdlogan / home.com> wrote: >"Josh Stern" <jstern / foshay.citilink.com> wrote >> In my experience, overloading based on the number of arguments >> is usually not a good programming style, but overloading >> based on the type of arguments often is. >In my experience overloading based on type of arguments is not >a good idea either. Mistakes can be made that are confusing, One could say the same thing about every feature of every language...and that goes double for every feature that is partly syntactic sugar for programmer convenience. >and the feature itself complicates the language design and >implementation more than it is worth. > >A better solution is to distinguish these cases in the name of the >method itself. It allows the language to remain simple and makes >the application source more readable. There are important programming techniques, such as generic programming, that become unavailable to a strongly typed language in that case. Ruby doesn't need overloading in order to do generic programming because it is weakly typed. But weak typing allows for extra errors to occur. So far as I can see, the only motivation to allow overloading based on types in Ruby would be as a partial substitute for strong typing, to be used at the programmer's discretion. -= Josh