On Nov 11, 2007 12:48 PM, Rick DeNatale <rick.denatale / gmail.com> wrote: > On Nov 11, 2007 5:29 AM, Matthew Boeh <mboeh / desperance.net> wrote: > > > > On Sun, Nov 11, 2007 at 07:06:44PM +0900, Jordi wrote: > > > > IIRC, in Ruby everything is message sending to objects even in the > > > disguise of Object#method, at least conceptually. > > > > > > > Conceptually, yes. But as far as I can tell, Object#respond_to? is effectively > > equivalent to: > > > > def respond_to?(message) > > !!method(message) rescue false > > end > > > Oh I hope not. > > class PresidentOfTheUnitedStates > def trigger_global_thermonuclear_war > # code to end civilization as we know it. > end > end > > PresidentOfTheUnitedStates.new.respond_to?(:trigger_global_thermonuclear_war) Another thought which occurred to me after posting. I've referred to the use of respond_to? as "chicken typing" http://talklikeaduck.denhaven2.com/articles/2007/10/22/chicken-typing-isnt-duck-typing If respond_to? really was equivalent to sending the message to see what happened, then the execution of side effects raise the possibility of curiosity killing the cat, or in this case the chicken! -- Rick DeNatale My blog on Ruby http://talklikeaduck.denhaven2.com/