Re: OO polymorphism


   I think that you can find exactly the same squabble in the "expert"
   You have those that consider an object as a sophisticated case of
a record, in that case polymorphism is to be intended as "subtype
polymorphism". This all originated with Luca Cardelli seminal paper "A
semantics of multiple inheritance" (Info&Compu n.76). And then there are
tons of other references that I could give you.
   Then there are those like me (from an original idea of Giorgio
Ghelli), or Craig Chambers that agree with you in that this kind of
polymorphism is nothing but a special kind of "ad hoc" polymorphism. I
can cite you my book (OOP: a unified foundation Birkhauser).
   It is fair to say that the former approach has much more followers
than the second (but you know also Windows has much more users than
other OS ;-)
    So if you want to show that you are right, I guess you can show him
a paper that I wrote on TOPLAS 17(3):431-447, March 1995 "Covariance and
contravariance: a conflict without a cause" I suggest this since it is
not technical at all. 
    If you want to show him that you both are right then the only paper
I know that presents both approaches is "On binary methods". Theory and
Practice of Object Systems 1(3):221-242. 1996. John Wiley & Sons, Inc.
  But in no case show him the work of Luca Cardelli alone :-)



On Sat, 2002-11-23 at 23:22, Lauri Alanko wrote:
> [----- The Types Forum, http://www.cis.upenn.edu/~bcpierce/types -----]
> Hello.
> I was having a minor terminological squabble with someone, and since we
> reached no solution, I thought to ask the experts.
> Here's the issue. In the object-oriented culture, "polymorphism"
> typically means dynamic dispatching: methods in subclasses can operate
> differently from methods in superclasses. The question is: where does
> this sort of behavior fit in the Cardelli/Wegner taxonomy of different
> kinds of polymorphism [CW85]?
> My view is that this is a special, systematic form of ad
> hoc-polymorphism: an operation can have multiple differing
> implementations, one of which is chosen depending on the type of the
> function's argument. Although in OO languages this dispatching is
> dynamic and based on an object's runtime _class_, and a strict
> interpretation of "type" limits the concept of polymorphism to a purely
> static context, nevertheless in Benjamin Pierce's types book [Pie02, p.
> 340] the statically untyped multimethods of CLOS are counted as ad
> hoc-polymorphism. To my mind single-dispatch OO is essentially a limited
> version of the same.
> My opponent contends that what is found in the methods of eg. C++ and
> Java is, in fact, inclusion polymorphism: an argument of a subtype can
> be used wherever an argument of a supertype can. Both the
> Cardelli/Wegner paper and Pierce's book seem to imply the same. However,
> in the original paper it is said of inclusion polymorphism [CW85, p.
> 478]:
> 	Similarly, operations are careful to interpret the
> 	representations uniformly so that they can work uniformly on
> 	elements of subtypes and supertypes.
> Dynamic dispatch doesn't seem to me to be "uniform" to me, although of
> course at the implementation level there usually is a "uniform"
> operation of looking up the implementation from a vtable and jumping to
> that. So I'd limit pure inclusion polymorphism to such things as union
> types, record types and non-virtual methods: the "same thing" is done to
> all arguments regardless of their exact type (or class).
> Can someone offer advice on which is the preferable interpretation? I'll
> gladly accept "they both are, silly" for an answer. I'm just interested
> in hearing if there's an established consensus on this.
> Thanks for any feedback.
> Lauri Alanko
> la@iki.fi
> [CW85]	Cardelli, Luca and Peter Wegner. On understanding types, data
> 	abstraction, and polymorphism. Computing Surveys, 17(4):471-522,
> 	December 1985.
> [Pie02] Pierce, Benjamin. Types and Programming Languages. MIT Press,
> 	2002.