From: gabriele renzi Date: 2005-12-12T03:32:37+09:00 Subject: Re: lib for optional static typing Austin Ziegler ha scritto: > On 11/12/05, gabriele renzi wrote: > >>Oh, the nicety of >> def Math.sqrt(Positive p) >>:) > > > Hm. No. That would end up requiring a significant change to Ruby, > because sqrt is legal on negative numbers, as long as you have > imaginary (complex) number support available. yeah, I'm not really suggesting changing Math.sqrt, just an example. > So you would then have > to have overloading instead of simple overriding as Ruby currently > does, because you'd need def Math.sqrt(Positive p) and def > Math.sqrt(Negative p). > > Overloading, I have come to believe, is a nightmare compared to > duck-typing. That's one of the reasons I oppose *anything* that > threatens to put it into Ruby, because it's a mess. > I was thinking of multimethods, more than simple overloading C++ style, but I'm not sure if that belongs to ruby so I won't argue on this. But would you please explain why do you think multiple dispatch is a bad thing, it would be interesting to hear the reasons that brought you to this conclusion.