On Wed, Feb 18, 2009 at 2:35 PM, Joel VanderWerf <vjoel / path.berkeley.edu> wrote: > Roger Pack wrote: >>>>> >>>>> Then how it is different from >>>>> foo.bar if foo.respond_to?(:bar) >>>>> >>>>> ? >>>> >>>> You don't have to write foo and bar twice :) >>>> >>>> I'm with you in thinking that adding another syntax >>>> foo.?bar >>>> seems a little much when a new method will do. >>>> -=r >>> >>> Agree on both points. But what does the new method return? Oh I gotcha. It would return something like Yusuke Endoh's suggestion... Implementation image: class Object def if_not_nil self end end class NilClass def if_not_nil obj = BasicObject.new def obj.method_missing(*) nil end obj end end not sure how the if_responds_to method would look like, exactly. -=r