>>>>> "C" == Christoph Rippel <crippel / primenet.com> writes:


C> The real interesting point is of course the multi-method lookup 
C> - the point where type-based overloaded functions are both slow 
C> and muddled with Koenig lookups etc.. (the following leaves
C> out the question on how to generalize module inclusion but this
C> can probably be done coherently as well) 
C> The basic strategy probably should be lexicographic over the mtype
C> components in our example an double object since this strategy
C> is simple and coherent. In our example this would be 
C> [Float,Float],[Float,Numeric],[Float,Object], [Numeric,Numeric]
C> ,..., [Object,Object] 

 You can have multi-dispatch if you write

   class Object2
      def mself(Float a, Float b)
          # work with 2 float
      end
   
      def mself(Float a, Numeric b)
          # work with float and numeric
      end
   
      def mself(Object a, Object b)
          # work with all other objects
      end
   end


 This can be easily extended to a module.



Guy Decoux