Newsgroups: comp.lang.smalltalk,comp.object
Path: cantaloupe.srv.cs.cmu.edu!rochester!udel!news.mathworks.com!newsfeed.internetmci.com!howland.reston.ans.net!vixen.cso.uiuc.edu!uchinews!news
From: Bob Hathaway <75027.1663@compuserve.com>
Subject: Re: Polymorphism One More Time
X-Nntp-Posting-Host: ford.uchicago.edu
Message-ID: <DoFGqD.3B2@midway.uchicago.edu>
Sender: news@midway.uchicago.edu (News Administrator)
Organization: Object Currents
References: <NEWTNews.13339.826235188.hampton@interramp.com> <3146E905.2F45@concentric.net> <314766B6.317D@amd.com> <milodDoA31u.JF4@netcom.com>
Date: Sun, 17 Mar 1996 19:56:37 GMT
Lines: 85
Xref: glinda.oz.cs.cmu.edu comp.lang.smalltalk:36102 comp.object:46091

In article <milodDoA31u.JF4@netcom.com>,
John DiCamillo <milod@netcom.com> wrote:
>From: Schaaf
>>...
>...
>Also, I found your "definition" of polymorphism (essentially, 'that
>property which results in subsitutability' -- my paraphrase) lacking.
>To me, it's as if you had defined water as 'that which makes one wet'.
>True, but not very satisfying.

As polymorphism means differing forms, a simple and direct analog in the
object domain should refer to differing forms of objects.  Strachey applied
polymorphism in passing to the functions in use during his day, but OO
embodies a new paradigm and methodology and calls for a new technical
nomenclature.  As objects provide the locus of behaviour, differing behaviour
results from polymorphism of objects; not the reverse.

Allels provide an example, denoting a locus for genes of differing forms,
like a polymorphic reference to varying forms of a gene, which would be
implemented polymorphically using class inheritance for the genes and
subtyping inheritance for the allel, or perhaps classification by phenotype
or behavoiur.  Or as used in "The Origin Of Species", where inclusion
polymorphism specifies the differing forms of species, modeled with class
(representation) inheritance to generate instances, and inclusion polymorphism 
classifying them taxonomically or conceptually by inheritance of type
(although in simple programming the two are often the same).

Another interesting property is that type schemas are subjective and
arbitrary, as often various conceptual schemas will be appropriate depending
on the problem at hand.  But in the design domain, choice of representation
is also subjective, unlike natural objects in the real world (excepting
genetic engineers, perhaps).

The Liskov Substitution Principle seems a consequence of inclusion
polymorphism of types, or what I call subtype polymorphism; a property
of classification applied to programming.  In analysis, the set of life
is obviously a superset of plants and animals (polymorphism); substitution
then becomes obvious, as an animal reference can refer to any plant or
animal.  Polymorphism comes into play twice, in the actual plants and
animal's makeup and in the classification scheme used to to describe them,
something supported to some extent in OO languages such as C++'s abstract
classes.  Programmatical use of type typically tests "object isMember of
Type", while information systems typically reverse the direction and use
type to denote extension, or all instances.

>>...
>>concept of polymorphism would exist even if c++ did not.  Defining it as
>>being composed of "inclusion" and/or "overloading" simply because one's
>>favorite language has chosen to break the implementation along those lines
>>obscures the concept beneath.  
>
>I now understand your concern, but I do not agree with your premise.
>Cardelli's definition of polymorphism is rooted in type theory -- a
>branch of abstract mathematics independent from any particular language.
>And the four 'kinds' of polymorphism discussed in his definition,
>Inclusion (or subtype), Parametric, Overloading, and Coercion add
>richness to the concept (a bit like recognizing that water may also be
>a vapor or a solid).

C+W's paper includes representation inheritance under the definition of
inclusion polymorphism.  And Strachey and C&W refer to Ad Hoc Polymorphism
as artificial - Universal Polymorphism is the real McCoy and possesses
a unifying concept.

>>I believe the statement of mine to which you are referring is: "If one 
>>recognizes the fundamental concept underneath, the compromises made by c++ 
>>become visible, and Smalltalk is more easily recognized for what it is--small 
>>and beautiful."
>
>Yes. I think that by ignoring the differences between the many kinds
>of polymorphism (in particular, the fact that all four lead to a 
>different kind of substitutability, even in non-OOPLs), it is you who
>is ignoring the "fundamental concept underneath".  Thus, I found your
>assertion hollow.

The general principle of objects taking differing forms is the forest
and the differing kinds of polymorphism are the trees.  You mention the
four kinds, however C+W's Ad Hoc Polymorphism, taken from Strachey, isn't
considered paradigmatic of polymorphism, only Universal Polymorphism's
parametric and inclusion polymorphism are considered true and they are
closely related.  As you pointed out elsewhere in this thread, inclusion
polymorphism simply provides a greater degree of control.

Best Regards,
Bob
