home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.object
- Path: sparky!uunet!enterpoop.mit.edu!ira.uka.de!math.fu-berlin.de!neuro.informatik.uni-kassel.de!mpaul
- From: mpaul@neuro.informatik.uni-kassel.de (Manfred Paul)
- Subject: Re: What is polymorphism?
- Message-ID: <OD60USH@math.fu-berlin.de>
- Followup-To: What is 'polymorphism'?
- Sender: news@math.fu-berlin.de (Math Department)
- Organization: Dept. Comp. Science - Uni Kassel
- Date: Tue, 26 Jan 1993 17:11:43 GMT
- Lines: 59
-
-
- In article <PCG.93Jan25220542@decb.aber.ac.uk>, pcg@aber.ac.uk (Piercarlo Grandi) writes:
- |>
- |> >>> On 21 Jan 93 02:44:52 GMT, objsys@netcom.com (Bob Hathaway) said:
- |>
- |> Hathaway> What Is Polymorphism?
- |>
- |> Hathaway> For a Brief Answer: Polymorphism is the ability of an object
- |> Hathaway> to assume or become many different forms of object and for
- |>
-
- (stuff deleted)
-
- |> Neither polymorphism (inclusion or parametric) nor ad hoc polymorphism
- |> involve any ability for an object to assume different forms.
- |>
- |> Polymorphism is about how restricted is the set of classes that a
- |> pointer value may denote (and pointer values are not, in virtually all
- |> languages, objects themselves), and ad hoc polymorphism is about
- |> procedure names and signatures, which are not objects either.
- |>
- |> --
- |> Piercarlo Grandi <pcg@aber.ac.uk> c/o Dept of CS
- |> University of Wales, Penglais, Aberystwyth SY23 3BZ, UK
-
- I don't want to interfere in the discussion (frankly I haven't got time
- enough to spend on this). BUT:
-
- You seem to have read Cardelli/Wegner's paper on types. Please reread it.
- Polymorphism occurs in languages with some notion of types, and it (usually)
- means, that a given object "has more than one type" (put very (!) informally).
-
- If the type expression describing the object's type contains (type) variables,
- you have parametric polymorphism (an instantiation may supply a type for
- this variable according to some constraints (again informally)). If only
- substitution along an inheritance path is allowed, you have inclusion poly-
- morphism.
-
- POLYMORPHISM HAS NOTHING COMMON WITH void * IN C / C++!!!! Your "examples"
- suggest a misconception on that one.
-
- BTW, having "polymorphic type" is in no way restricted to procedures (or
- functions)! If you declare a type " Stack[ alpha ] " (alpha being a type
- var) then an object of this type is a polymorphic object. Just because this
- isn't C(++) doesn't rule this thing out, there are other languages! I admit
- that the term is used mostly in connection with methods, but I wonder if
- it is really well understood (especially by writers of 'glamour ads' promo-
- ting system FOO).
-
- BTW, ever came across SmallTalk, where methods (and blocks) are first-class
- "functional _objects_"?!
-
- --
- +----------------------------+----------------------------------------+
- | Manfred Paul | |
- | Dept. Comp. Science | |
- | University of Kassel | |
- | Germany | |
- +----------------------------+----------------------------------------+
-