From: Chris Uzdavinis Date: 2001-05-08T21:50:05+09:00 Subject: [ruby-talk:14863] Re: Polymorphic methods "Benjamin J. Tilly" writes: > The basic problem is that you want the type to matter, so > somewhere (explicitly or implicitly) it has to be tested. > And you have logic that you want to happen so somewhere > that logic must be written. You can write the code in > many ways, move the logic around, find ways to have one > case "feed off of" another, etc. Ruby offers facilities > to do all of that including if statements, closures, > OO programming, and modules. > > But there is no way to remove the fact that if the type is > to matter then it must be tested, and logic that exists > must be written. I agree, the type still must be checked in any case since it's not compiled. But if it can be done inside the interpreter it'll be considerably faster than if the checks are hand-coded in Ruby. (There is less to parse, less interpretation to be done, and the code to do the selection can be optimized C code.) -- Chris