Re: Polymorphism vs. Overloading

dekker@dutiag.twi.tudelft.nl (Rene Dekker)
Mon, 31 Oct 1994 22:27:14 GMT

          From comp.compilers

Related articles
[13 earlier articles]
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)
Re: Polymorphism vs. Overloading danhicks@aol.com (1994-10-31)
Re: Polymorphism vs. Overloading odersky@ira.uka.de (Martin Odersky) (1994-10-31)
Re: Polymorphism vs. Overloading bevan@cs.man.ac.uk (1994-10-27)
Re: Polymorphism vs. Overloading pjj@cs.man.ac.uk (1994-10-28)
Re: Polymorphism vs. Overloading jhf@c3serve.c3.lanl.gov (1994-10-28)
Re: Polymorphism vs. Overloading mmcg@bruce.cs.monash.edu.au (1994-10-29)
[11 later articles]
| List of all articles for this month |
Newsgroups: comp.compilers
From: dekker@dutiag.twi.tudelft.nl (Rene Dekker)
Keywords: polymorphism
Organization: Delft University of Technology
References: 94-10-144 94-10-154
Date: Mon, 31 Oct 1994 22:27:14 GMT



Gabriela O. de Vivo <gdevivo@conicit.ve> wrote:


jhallen@world.std.com (Joseph H Allen) writes:
>Last week I was invited to join a Thesis (MsC) presentation.
>At some point a question raised about the exact difference between
>Polymorphism and Overloading.


Roughly said:
You have overloading if MULTIPLE functions share a SINGLE
interface, each for a particular combination of parameter types.
You have polymorphism (in the strict sense) if a SINGLE function
has a single interface for MULTIPLE combinations of parameter types.


Note that inheritance in the OO sense can be seen as a combination of
overloading and polymorphism.


>The difference is purely syntactical. Calls to overloaded functions look,
>well, like function calls. Calls to polymorphic functions require a dot or
>'->' somewhere. Really, that's the only difference.


I don't know what you mean exactly by 'require a dot or -> somewhere',
but calls to overloaded functions need not be syntactically different
from calls to polymorphic functions. It might be that certain languages
require such a difference (I don't know of any).


>Next question: is there a difference between the functional language notion
>of a polymorphic type and inheritance (other than functional language type
>hierarchies being limited to one level)?


Mmm, this is tricky question, especially because the functional
language 'polymorphic type' and 'type hierarchy' are different notions,
and IMHO type-hierarchies need not be limited to one level.


The difference between a type-hierarchy and inheritance lies in
dynamic binding: type-hierarchies usually require the actual type to
be know at compile time, with inheritance the actual type can be
unknown until run time.


For more information on the different between polymorphism and
overloading, take a look at the exellent article:


@article{cardelli.wegner,
      author = "L. Cardelli and P. Wegner",
      title = "On Understanding Types, Data Abstraction, and Polymorphism",
      journal = "Computing Surveys",
      volume = 17,
      number = 4,
      pages = "471-522",
      year = 1985
      }


Ciao, Rene'


--
Rene Dekker Delft University of Technology
R.Dekker@twi.tudelft.nl Department of Technical Mathematics and Informatics
Tel: +3115 783850 Julianalaan 132
Fax: +3115 787141 2628 BL Delft, The Netherlands
--


Post a followup to this message

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