From: "T. Onoma" Date: 2003-11-19T13:08:24+09:00 Subject: Duck Type System? ( was: stereotyping...er...way too long :) a wrote: > how about simply > > obj.respond_to? :read # => true > > obj.respond_to? :read, IO # => true > > obj.respond_to? :read, IO, Proc # => false > > > becomes > > class Object > def respond_to?(meth, *signature) > # new stuff... > end > end > > nice and backward compatible. easy to remember. a good improvement to #respond_to? no doubt, and easily implemented. but duck_signiture would actually insepect a method to determine the respond_to? requirements of its parameters, which is quite a different sort of beast. in fact, i think this is a good CHALLENGE FOR ALL RUBYISTS! Implement #duck_signiture in pure Ruby. can you do it!? ;) if you become frustrated this is funny: http://www.randomhouse.com/features/davebarry/emoticon.html -t0