Newsgroups: | comp.compilers |
From: | ok@goanna.cs.rmit.OZ.AU (Richard A. O'Keefe) |
Keywords: | polymorphism, design |
Organization: | Comp Sci, RMIT, Melbourne, Australia |
References: | <9008310419.AA06194@karakorum.berkeley.edu> <2509@l.cc.purdue.edu> |
Date: | 7 Sep 90 08:57:46 GMT |
In article <2509@l.cc.purdue.edu>, hrubin@l.cc.purdue.edu (Herman Rubin) writes:
> In article <BURLEY.90Sep1013113@world.std.com>, 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]
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.