From: ts Date: 2001-02-07T01:11:19+09:00 Subject: [ruby-talk:10424] generic method I've a problem with generic methods. With this example, what do you expect for the second call (i.e. a.toto(B::C.new)). pigeon% cat b.rb #!./ruby class B class C end end module D def toto(B::C b, String d = "") puts "B::C #{b} -- String #{d}" end end class A include D def toto(B::C b, Array c = [12, 24]) puts "B::C #{b} -- Array #{c.join ' '}" end def toto(Array b, B::C c = B::C.new) puts "Array #{b.join ' '} -- B::C #{c}" end def toto(Array b, Array c = [3, 4]) puts "Array #{b.join ' '} -- Array #{c.join ' '}" end end a = A.new a.toto(B::C.new, "toto") a.toto(B::C.new) a.toto([1, 2]) pigeon% b.rb B::C # -- String toto B::C # -- Array 12 24 ./b.rb:29: ambiguous call for toto ([Array, B::C] -- [Array, Array]) (RuntimeError) pigeon% it must give an error or not ? Guy Decoux