Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!yale!mintaka!spdcc!ima!esegue!compilers-sender From: ok@goanna.cs.rmit.OZ.AU (Richard A. O'Keefe) Newsgroups: comp.compilers Subject: Re: Defining polymorphism vs. overloading Keywords: polymorphism, design Message-ID: <3709@goanna.cs.rmit.oz.au> Date: 7 Sep 90 08:57:46 GMT References: <9008310419.AA06194@karakorum.berkeley.edu> <2509@l.cc.purdue.edu> Sender: compilers-sender@esegue.segue.boston.ma.us Reply-To: ok@goanna.cs.rmit.OZ.AU (Richard A. O'Keefe) Organization: Comp Sci, RMIT, Melbourne, Australia Lines: 39 Approved: compilers@esegue.segue.boston.ma.us In article <2509@l.cc.purdue.edu>, hrubin@l.cc.purdue.edu (Herman Rubin) writes: > In article , burley@world.std.com (James C Burley) writes: > > 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).... > > o Polymorphism means using the same piece of code to operate on objects > > of different types. Let me summarise that: DIFFERENT code for different types => OVERLOADING SAME code for different types => POLYMORPHISM (ignoring implementation detail; the SELF compiler will compile different versions of what's _conceptually_ the same code.) They are means to different ends. > Thus if y and z are long integers, this becomes (different assembler languages > have somewhat different notation, and this may not correspond to any) > ADDL y,z > and if they are floating > ADDF y,z This sounds like _different_ code for the different types, so overloading. > Now ADDL and ADDF will operate on either, so those are polymorphic and > not overloaded. And now I am completely lost. The NS32?32 has addd (equivalent of ADDL) and addf (equivalent of ADDF) and they _won't_ operate on either, they are very specific. Same for every machine I've ever used except the B6700 and Xerox Lisp machine (both of which have _one_ polymorphic add). -- [Herman's definition does seem to be the reverse of the one favored by other people. -John] -- Send compilers articles to compilers@esegue.segue.boston.ma.us {ima | spdcc | world}!esegue. Meta-mail to compilers-request@esegue.