Path: utzoo!utgpu!watserv1!watmath!att!ima!esegue!compilers-sender From: wright@gefion.rice.edu (Andrew Wright) Newsgroups: comp.compilers Subject: Re: Defining polymorphism vs. overloading Keywords: design, polymorphism Message-ID: <1990Sep2.220039.4966@rice.edu> Date: 2 Sep 90 22:00:39 GMT References: <9008310419.AA06194@karakorum.berkeley.edu> Sender: compilers-sender@esegue.segue.boston.ma.us Reply-To: wright@gefion.rice.edu (Andrew Wright) Organization: Rice University, Houston Lines: 27 Approved: compilers@esegue.segue.boston.ma.us In article <9008310419.AA06194@karakorum.berkeley.edu> oliver@karakorum.berkeley.edu (Oliver Sharp) writes: > o Overloading means using the same name (or symbol) to invoke different > code depending on the types of the arguments (or operands). So, an example > ... > o Polymorphism means using the same piece of code to operate on objects of > different types. In LISP, cons is polymorphic because you can give it > arguments of different types but it goes ahead and does its thing without > worrying about it. C. Strachey originated the terms "ad-hoc" and "universal" polymorphism to distinguish these issues. overloading is an example of ad-hoc polymorphism, automatic coercions such as real->int are another. ML is the best example of universal polymorphism (what you call simply polymorphism above). See: @article{Cardelli86, author = "Luca Cardelli and Peter Wegner", year = "1985", month = "December", journal = "ACM Computing Surveys", volume = "17", number = "4", pages = "471-522", title = "On Understanding Types, Data Abstraction, and Polymorphism" } -- Send compilers articles to compilers@esegue.segue.boston.ma.us {ima | spdcc | world}!esegue. Meta-mail to compilers-request@esegue.