From: Christoph Date: 2002-09-28T01:43:01+09:00 Subject: Re: adding overload to ruby "ts" wrote ... > C> It would be helpful (I have an idea but ...) if you could > C> describe what your next_method call does ... > > Same than Dylan, except that I don't give the possibility to change the > dispatch at runtime (i.e. #next_method take 0 argument) which is, at least > for me, a bad thing Thanks! > .... > pigeon% cat d.rb > #!./ruby -w > class B < Array; end > module M > def a(B b) end > end > > class A > include M > def a(Array a) end > end > pigeon% > > pigeon% d.rb > ./d.rb:9: Possible ambiguous call M [B] -- A [Array] (NameError) Isn't this the same ambiguity you get with regular inheritance? --- class B < Array; end class ProxyA def a(B b ) end end class A < ProxyA def a(Array b) end end obj = A,new obj.a( Array.new(1) ) # not ambiguous obj.a(B.new(1) ) # ambiguous # with the rule(d) of my previous post the ambiguity # would be resolved to a call of A#a(Array) --- If you buy into the evil multi-dispatch you either have live with occasional ambiguity-errors or use some sort of ambiguity resolution mechanism. /Christoph