From: Bulat Ziganshin Date: 2002-09-27T16:10:11+09:00 Subject: Re: adding overload to ruby Hello Yukihiro, Friday, September 27, 2002, 10:48:25 AM, you wrote: |bclrS20tse>> method overloading. If you really believe that type checking |bclrS20tse>> is that important, then you should probably be using another |bclrS20tse>> language. YM> | YM> |you are not matz ;) YM> If you really believe that compile time type checking is that YM> important, then you should probably be using another language. YM> matz. ;-) YM> p.s. YM> In fact, I'm *not* against method overloading because it helps "divide YM> and conquer" the problem, not for type checking. 1) i say about dynamic type checking, as does overload.rb. see start of this thread 2) "type checking" now goes to "protocol checking". i agree with that, but class/mixin must be one variant of protocol. i think that "pattern matching" is too far from ruby to be practical 3) code from date.rb: def - (x) case x when Numeric; return type.new0(@rjd - x, @sg) when Date; return @rjd - x.rjd end raise TypeError, 'expected numeric or date' end uses dispatch-on-type, not specially designed protocol. it is common practice now. i don't understand why implementing this practice in lang itself is bad idea: def -(Numeric x) type.new0(@rjd - x, @sg) end def -(Date x) @rjd - x.rjd end this code is just the same as current one -- Best regards, Bulat mailto:bulatz@integ.ru