From: Alan Chen Date: 2002-09-13T08:13:44+09:00 Subject: Re: not grasping the method overloading/multi-dispatch thing On Fri, Sep 13, 2002 at 07:15:36AM +0900, Paul Brannan wrote: > On Fri, Sep 13, 2002 at 05:40:53AM +0900, Phil Tomson wrote: > > In Ruby it's not really considered a downside... it seems to be an > > acceptable practice. > > But should it be? If I write a class, and someone modifies it, he had > better have a darn good reason for modifying it. If everyone goes > around messing with the Integer and Float classes, how can we make any > guarantees about the behavior of Integers and Floats? > > > Perhaps this idea should be proposed as an idiomatic way of > > solving the problem - ie. "We don't need multi-methods since all classes > > are open in Ruby". > > Not all classes are open. I sometimes freeze my classes to make sure no > one messes with them behind my back. > > Paul So now, I might have a darn good reason to modify your class and you've gone and frozen it ;) I don't think the point of the language is to bulletproof it self from mis-programming. I guess my problem is that multi-methods seems to dedicate alot code, execution speed, and complexity to mostly prevent me from doing things which may be perfectly reasonable. I think multi-methods would take away from the focus on getting the code and design to function well and move emphasis to "type wrangling". Don't get me wrong, I know that typing helps eliminate a class of errors, but it adds a whole host of errors and design difficulties which I think obfuscate to problem - at least at the level of programming that Ruby is best suited for. -- Alan Chen Digikata LLC http://digikata.com