ODOWA
Accueil Inscription Contact

Expanding and compressing in Ruby Method calls

One of the things I didn't like in Ruby at all is the support for method overloading. You have no ways to support it in a straight forward way other than to define a single method that takes a variable number of arguments. def foo(*f) f.each { |a| puts a } end foo("Hello", "world") What the above does is that it converts the multiple parameters into a single array and passes it to the method call. I think this is really bad because method overloading is a very basic requirement. However, Ruby seemed to support a... lire la suite

Lien du post: http://blogs.msdn.com/abhinaba/archive/2008/01/16/expanding-and-compressing-in-ruby-method-calls.aspx

Sur le même thème :