Re: Polymorphism vs. Overloading

Rob MacLachlan <ram@cs.cmu.edu>
Tue, 25 Oct 1994 15:40:17 GMT

          From comp.compilers

Related articles
[7 earlier articles]
Re: Polymorphism vs. Overloading ichudov@wiltel.com (1994-10-28)
Re: Polymorphism vs. Overloading strohm@mksol.dseg.ti.com (1994-10-28)
Re: Polymorphism vs. Overloading ryer@dsd.camb.inmet.com (1994-10-28)
Re: Polymorphism vs. Overloading mac@coos.dartmouth.edu (1994-10-25)
Re: Polymorphism vs. Overloading joe@sanskrit.ho.att.com (1994-10-31)
Re: Polymorphism vs. Overloading geld@cs.sun.ac.za (1994-10-31)
Re: Polymorphism vs. Overloading ram@cs.cmu.edu (Rob MacLachlan) (1994-10-25)
Re: Polymorphism vs. Overloading billk@cs.ukans.edu (1994-10-31)
Re: Polymorphism vs. Overloading Mike.Chapman@muc.de (Mike Chapman) (1994-10-31)
Re: Polymorphism vs. Overloading jsm@id.dth.dk (1994-10-31)
Re: Polymorphism vs. Overloading sofkam@rpi.edu (1994-10-31)
Re: Polymorphism vs. Overloading andand@csd.uu.se (1994-10-26)
Re: Polymorphism vs. Overloading dekker@dutiag.twi.tudelft.nl (1994-10-31)
[17 later articles]
| List of all articles for this month |

Newsgroups: comp.compilers
From: Rob MacLachlan <ram@cs.cmu.edu>
Keywords: polymorphism
Organization: School of Computer Science, Carnegie Mellon
References: 94-10-144 94-10-154
Date: Tue, 25 Oct 1994 15:40:17 GMT

One answer to the distinction between polymorphism and overloading is that
the terms historically came from different areas of work, and were used to
describe different languages.


I think overloading is an older term, it generally referred to the
capability for operators to generate different code depending on the types
of the operands. Non-extensible static overloading of arithmetic
operations was fundamental to use of +, etc. on both integers and floats.
Compiler implementors fairly quickly realized that this capability could
be made accessible to users as well. I don't know if the Algol 68
standard defined operator overloading, but some implementations did.
Overloading became a much more widely known concept with the appearance of
Ada (late 70's.)


The first time I heard of "polymorphism" was in discussion of CLU. I
believe that the language semantics community prefers the term
"polymorphism", and considers it to subsume overloading. There have been
some taxonomies of polymorphism published, with two styles that I recall
being "parametric" (ML style) and "ad-hoc" (Lisp being an example.)


Parametric polymorphism is considered by some people to be "the good
kind". In parametric polymorphism, functions can operate on any type of
arguments, but always do semantically the same thing (because only one
definition of the function is supplied by the programmer.)


Both object-oriented method dispatch and static overloading can probably
be called forms of ad-hoc polymorphism. The polymorphism is "ad hoc"
because any semantic uniformity of behavior across types is imposed by the
programmer.


    Rob
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.