2008/5/28 Tobias Weber <towb / gmx.net>: > as a newcomer I miss method overloading with named parameters and types > (Objective-C!). Mainly because my code is riddled with ugly "case > argument.class" and "raise unless Integer". But maybe that's the problem. You cannot expect to carry your Objective-C style of programming over to Ruby. Instead, if you want to have overloading you need to either use different method names (appropriate if the overloaded methods act differently) or you can do it with a single method (e.g. if the overloading was just there to adjust type - for example on version accepts an int and another accepts a float and internally you continue processing with a float). > What is the Duck way to check arguments? I have to because I'm passing > on to a rather fragile web service. The duck way is to not check arguments. > I only need numbers (ids) and strings in my instance variables, but > considered making a class for each one to catch illegal data in > initialize. It's difficult to answer on such a general scale. Usually, if there are particular requirements you have on arguments passed to methods you should check inside the method that receives them. Note, that for integers there is to_int so you can do: class Foo def doit length @l = length.to_int end end Can you give a more concrete example? Kind regards robert -- use.inject do |as, often| as.you_can - without end