Chaim Frenkel wrote:
>
> [ ... ] for me polymorphism is action-at-distance of the worst
> stripe.  Its the cheap and dirty way of doing OO. [...] I see
> very little reason to have two methods with different signatures.

Method signatures and polymorphism are orthogonal.  The latter
refers to different classes having differing implementations of
a method of the same name (often via inheritance and overriding)
and/or name + signature.

Say you had a base class for exception objects that defines a
method that returns whether or not Foo is true for that class.
Say you derive a descendent class from that base class via
inheritance, and then extended the derived class to add a new
instance variable.  Say you then, in your derived class, override
the method that returns whether or not Foo is true to take your
new instance variable into account.

With polymorphism, one doesn't have to know whether one has an
instance of the base class or an instance of the derived class
(using kludgery such as isa), one can just say $o->IsFoo and
both cases work as per Fooing.

Signatures don't need to enter into it.  For more information see
http://www.cyberdyne-object-sys.com/oofaq2/body/typing.htm#S2.1

Yours, &c, Tony Olekshy

Reply via email to