matz / zetabits.com (Yukihiro Matsumoto) wrote:
>
>Hi,
>
>In message "[ruby-talk:9242] polymorphism"
>     on 01/01/13, Maurice Szmurlo <maurice / europia.fr> writes:
>
>|are there plans to include into ruby method selection
>|by the number of arguments, or in other words polymorphism:
>
>Not really.
>
>I personally do not use the term 'polymorphism' for the concept you
>proposed.  But anyway I think the combination of it and optional
>argument (and variable number argument) increases program ambiguity.
>I'd like to avoid the pitfall C++ suffered.  Any good idea?

Don't do it and tell people it is very easy to write
their own dispatch function.  If someone wants to make
a method to simplify that they can.

For parametrized functions the argument
separation/recursion trick at

http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/8901

works well.  (I just did it, didn't think of it as a
technique of its own.  Christoph pointed out that it
was a more general technique.)

IMHO it should be enough to support virtually every
style of programming.  There is no need to make them
all feel like first class citizens. :-)

Cheers,
Ben
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com