In article <89939D76-01F7-4223-B5CF-A12ED2F45019 / mwilden.com>,
 Mark Wilden <mark / mwilden.com> wrote:

> > it stands
> > to reason that a language with objects whose types can change during
> > runtime would be well-served by a programming style that deals as
> > directly and economically as possible with precisely that condition.
> 
> Hmmm. Is it that objects change their type, or is it that variables do?

As far as I'm concerned objects do not have a type, only variables do. 
It determines what objects they can reference based on a trait like 
class, ancestor, interface. In Java.

So I'd say that Ruby doesn't even have types. You can never know in 
advance what methods the object in a certain variable might respond to.

And since message-maps are per-object, typed variables wouldn't even 
change that. Just like neither kind_of? nor .class === can help you.

responds_to? does help, but can return false negatives if the target 
overrides missing_method.

Consequently the most economic style for a Ruby method would be to just 
take whatever argument comes in and fire some messages. Deal with any 
excpetions. And at critical points maybe check the resulting value for 
tangible properties like > 0 or empty?.

-- 
  Tobias Weber