Hi --

On Sun, 6 Oct 2002, Massimiliano Mirra wrote:

>
> Since #respond_to? only checks whether an object responds to a call,
> not what it does in response; since #can? as an alias to #respond_to?
> would be misleading in that it wouldn't really check what the object
> does; since typing a la C or Java takes much away from the language
> and is no better indicator of the real behaviour of an object; what
> about this?

Personally I like #can?  but it doesn't help with the awkward two-headed
"obj.meth if obj.can?(:meth)" idiom.

>  class Foo def meth(bar) bar.passes?(TestBar) or raise ArgumentError
> end end Foo.new.meth(1) $ ruby --inline-tests foo.rb

What does #passes? actually do?


David

-- 
David Alan Black                      | Register for RubyConf 2002!
home: dblack / candle.superlink.net     | November 1-3
work: blackdav / shu.edu                | Seattle, WA, USA
Web:  http://pirate.shu.edu/~blackdav | http://www.rubyconf.com