From: ts Date: 2002-09-13T17:58:59+09:00 Subject: Re: not grasping the method overloading/multi-dispatch thing >>>>> "Y" == Yukihiro Matsumoto writes: Y> Guy, who did implement it in his "modified Ruby", might want to tell Y> you how he felt. Well, I can't say more than what I've said in [ruby-talk:26914] (sorry I can't give a better explanation, becuase of my bad english, why I think that it's not a good idea to add overloading in ruby). More, one day I've just written this : pigeon% cat b.rb #!./ruby class AA < Array end class A private def tt(Enumerable a) yield "Enumerable" end public def tt(Array a) yield "Array" next_method end def tt(AA a) yield "AA" next_method end def tt(String a) yield "String" next_method end end p A.instance_methods p A.private_instance_methods a = A.new a.tt(AA.new 1, 2) {|i| puts "received #{i}" } a.tt("string") {|i| puts "received #{i}" } a.tt(1 .. 2) pigeon% pigeon% b.rb ["tt"] ["next_method", "tt"] received AA received Array received Enumerable received String received Enumerable ./b.rb:32: private method `tt' called for # (NameError) pigeon% See the module (rather than the class) in the definition. This was my way to *kill* it because I know that when I've written it this will give, one day, some incoherence. Guy Decoux