home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / object / 5060 < prev    next >
Encoding:
Text File  |  1993-01-27  |  3.1 KB  |  71 lines

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