From: David Alan Black Date: 2002-02-13T23:48:07+09:00 Subject: qualms about respond_to? idiom Hi -- I'm cool with Ruby's emphasis on object interface rather than type. The only thing is... I just can't get myself to be happy about this idiom: if obj.respond_to? "method" then obj.method end I'm not sure how to express what I don't like about it -- but I guess the sheer repetitiveness of it, mainly. It always looks and feels like a kind of workaround to me, or like something is being done manually that should somehow just happen. I actually like the look and feel of this better: begin obj.method rescue NameError # stuff end because it doesn't feel like something's being done twice. But of course it's slow. (And I know it's not identical in functionality.) I don't know... I'm afraid this is more of a notation of a concern than anything constructive. Perhaps someone can give me a pep talk on why I should learn to love that idiom I don't love. David -- David Alan Black home: dblack@candle.superlink.net work: blackdav@shu.edu Web: http://pirate.shu.edu/~blackdav