home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / lang / ada / 2496 < prev    next >
Encoding:
Text File  |  1992-08-31  |  4.0 KB  |  82 lines

  1. Newsgroups: comp.lang.ada
  2. Path: sparky!uunet!gatech!usenet.ins.cwru.edu!agate!linus!linus.mitre.org!linus!mbunix!eachus
  3. From: eachus@Dr_No.mitre.org (Robert I. Eachus)
  4. Subject: Re: MI - clutching at straws
  5. In-Reply-To: pk@rwthi3.informatik.rwth-aachen.de's message of Mon, 31 Aug 92 15:36:41 GMT
  6. Message-ID: <EACHUS.92Aug31155744@Dr_No.mitre.org>
  7. Sender: news@linus.mitre.org (News Service)
  8. Nntp-Posting-Host: dr_no.mitre.org
  9. Organization: The Mitre Corp., Bedford, MA.
  10. References: <EACHUS.92Aug23173050@Dr_No.mitre.org>
  11.     <1992Aug31.153641.29954@Urmel.Informatik.RWTH-Aachen.DE>
  12. Date: Mon, 31 Aug 1992 20:57:44 GMT
  13. Lines: 67
  14.  
  15. In article <1992Aug31.153641.29954@Urmel.Informatik.RWTH-Aachen.DE> pk@rwthi3.informatik.rwth-aachen.de (Peter Klein) writes:
  16.  
  17.    It is important to keep in mind that genericity and inheritance are
  18.    orthogonal concepts (see Betrand Meyer's "Genericity versus Inheritance,
  19.    Journal of Pascal, Ada, & Modula-2, Vol. 7, No. 2, pp. 13-30,
  20.    Wiley 1988 on this). In restricted cases, one can be simulated by
  21.    the other. But this is pointless when we talk about the usefulness
  22.    of the concepts as such.
  23.  
  24.    They are different, agreed, but your conclusion does not follow.
  25. You asked how something could be done without MI.  If it can be be
  26. done using generics, then that is direcly related to the usefulness of
  27. generics and inheritance.
  28.  
  29.    What actually is lost when simulating inheritance with genericity
  30.    is polymorphism. In your example, the implementation of the extensions
  31.    is hidden from the base type. But the implementation of the basic
  32.    type reveals *which* extensions are planned. This has some severe
  33.    disadvantages...[Examples deleted.]
  34.  
  35.    This is why single inheritance is in Ada 9X.  Extensions not
  36. dreamed of when the original parent was declared can be provided using
  37. type derivation.  But the cases where you need two incompatible
  38. extensions to the same parent to be merged, while they can be created
  39. as examples, are the kind thing that respectable software engineers
  40. avoid like the plague.  Assume that you have some random abstarct type
  41. foo, and two extension of it. One makes lists of foos, and another
  42. creates trees of foos with a sort key.  A program which takes objects
  43. from lists and inserts them into trees makes sense and can be written
  44. naturally without MI).  A program which has objects which are
  45. simultanously in lists and trees, and uses MI to manage both
  46. structures is a mess.  Such a program can be created and made to work,
  47. but the list primitives will have to be aware of the tree primitives
  48. and vice-versa.
  49.  
  50.    In a more general sense, it cannot be reasonable to extend a basic type
  51.    by inheritance or by genericity depending on the fact whether you want
  52.    to combine some extensions later on. If you think that the extensions
  53.    should be done by inheritance, you'll end up missing MI if you want to
  54.    combine extensions on a higher level. On the other hand, if you say that
  55.    the extensions should be done using genericity, you won't need MI. But
  56.    in this case, you don't need inheritance at all.
  57.  
  58.    Close.  IMHO inheritance is one of the least important OO features
  59. being added to Ada 9X, but as I mentioned above it does have its uses.
  60. In Ada 9X as in Ada 83, generics will be a much more powerful tool,
  61. and should be the tool of choice in many areas where inheritance is
  62. naturally used in other OO languages.
  63.  
  64.    Eighty years ago automobiles had more wood in them than metal,
  65. today's cars contain little or no wood.  Should we conclude that
  66. modern cars are inferior because the manufacturing plants no longer
  67. have wood finishing facilities?  (Or because the cars no longer have
  68. buggy whip holders? :-) In my book, multiple inheritance has never
  69. been of more than marginal usefulness.  In a language with generics
  70. the best solution for any particular problem never seems to use MI, so
  71. let's leave it behind with the rest of the excess baggage, such as
  72. call by name.
  73.  
  74.  
  75. --
  76.  
  77.                     Robert I. Eachus
  78.  
  79. with STANDARD_DISCLAIMER;
  80. use  STANDARD_DISCLAIMER;
  81. function MESSAGE (TEXT: in CLEVER_IDEAS) return BETTER_IDEAS is...
  82.