From: patrick-may@... (Patrick May) Date: 2002-09-13T14:02:20+09:00 Subject: Re: not grasping the method overloading/multi-dispatch thing Paul Brannan wrote in message news:<20020912182059.X25425@atdesk.com>... > One possibility would be to make it hard to make a method that takes > only one type as a parameter: > > [example snipped] > > This would probably deter people from writing non-generic code, but > still allow them to do so. Well, that's the situation we're in now -- you can write methods that check the types of their arguments, but it is difficult. Making it easy, then making it difficult doesn't make sense to me. The real api designer question is: Is this behaviour, conditional execution on type, something we should encourage? Conditionals on type are a smell of code that could be moved from the users of a class to the class itself. It is easy enough to write these types of methods, and I think it leads to simpler, more flexible code. Think about all those useful, but slightly obscure, methods that ruby has: aString.ljust aString.reverse array.uniq hash.update integer.downto I doubt if everything in the standard library started as a part of the distribution. Many useful functions likely began as additions written by users of Ruby, and were later submitted to matz as RCR's. Ruby's excellant design is not only the product of forward thinking, but also the by-product of encouraging people to make these kinds of changes. So, why add easy static typing to ruby -- how many of these opportunities will we miss? How much will we slow the pace of innovation? That is my concern. ~ Patrick