From: Mike Stephens Date: 2011-01-28T07:05:15+09:00 Subject: Re: why is overloading invalid in ruby. Just to clarify what I was proposing (I am prepared to be corrected by the experts here) - when you specify parameters to a Ruby method, Ruby passes in variables. In Ruby, variables are references ie pointers to an object. They of themselves are all the same data type. You can pass in references to any object type. Ruby doesn't check the type of object being referred to. One reason is at no point have you indicated what type Ruby should expect. At run time, inside the method body, Ruby will attempt to pass the method name to the object referred to by your parameter. Only at that point do we need things to match up. The next step in the story is that = is a special case. It says make the variable on the left hand side point to the object on the right hand side. All other similar looking operators are actually methods on an object. Ruby simply sends the message to the object concerned and sees what happens. In this scenario you can see how Ruby can deal with varying types (the overloading gets shifted to the object being called - n possible object types gives you n possible overloads. However there's no corresponding way around the number (and order) of parameters without the less elegant solutions discussed above. Nobody sems to complain, so I suggest you don't worry about it. It's unlikely to cramp your style. -- Posted via http://www.ruby-forum.com/.