From: Mark Wilden Date: 2008-05-29T05:09:23+09:00 Subject: Re: The duck's backside On May 28, 2008, at 11:45 AM, Eleanor McHugh wrote: >> But if you want to check for numeric parameters, would it be better >> just to use Numeric === v ? I know this isn't the ducky way, but it >> certainly seems more "intentional." > > That'd be marginally more readable but to my mind it's overly > cautious: what's the point of using Ruby if you're still going to > follow static typing conventions? The only point of using Ruby (or any other tool in the universe) is to get a job done. :) I would never use a Ruby feature just because Ruby makes it possible. Numeric === v is not a static typing convention (see http://en.wikipedia.org/wiki/Type_system) . It's just OOP. It says in computer-understandable terms exactly what you expressed in English: "v is numeric." I don't even know what the ability to respond to :to_int means. Does that mean the entity is numeric? Does a numeric string qualify? Does a floating point number qualify? Could Array support this method? Does every class that responds to to_int do semantically equivalent things? (think Cowboy#draw and Artist#draw). The only way to tell is to test it or look it up. This doesn't make it "marginally" less readable than Numeric === v, IMO. Different strokes, of course... ///ark