home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / lang / ada / 3273 < prev    next >
Encoding:
Internet Message Format  |  1992-11-14  |  2.2 KB

  1. Xref: sparky comp.lang.ada:3273 comp.object:4224
  2. Newsgroups: comp.lang.ada,comp.object
  3. Path: sparky!uunet!charon.amdahl.com!pacbell.com!sgiblab!zaphod.mps.ohio-state.edu!rpi!batcomputer!cornell!uw-beaver!klamath.cs.washington.edu!chambers
  4. From: chambers@klamath.cs.washington.edu (Craig Chambers)
  5. Subject: Re: OOD, Ada, and Inheritance
  6. Message-ID: <1992Nov13.224508.18746@beaver.cs.washington.edu>
  7. Sender: news@beaver.cs.washington.edu (USENET News System)
  8. Reply-To: chambers@cs.washington.edu
  9. Organization: University of Washington
  10. References: <BxGpxt.FDw@cs.uiuc.edu> <1992Nov10.205810.5516@mcc.com> <1992Nov11.042043.9740@inmet.camb.inmet.com> <1992Nov13.203723.26049@cis.ohio-state.edu>
  11. Date: Fri, 13 Nov 92 22:45:08 GMT
  12. Lines: 28
  13.  
  14. In article <1992Nov13.203723.26049@cis.ohio-state.edu>, weide@elephant.cis.ohio-state.edu (Bruce Weide) writes:
  15. |> ...
  16. |> Or, by multiple implementations, do you mean to insist on run-time
  17. |> selection among different implementations?  If so, what examples would
  18. |> you (e.g., Ralph, or others holding this view) consider to be "good"
  19. |> examples of the use of inheritance for this purpose; to be contrasted
  20. |> with Rosen's examples, which are criticized as unrepresentative of
  21. |> good OO practices?
  22.  
  23. In my implementation of the Self compiler, I use "run-time selection
  24. among different implementation" to good effect in several data
  25. structures.  One of the simplest is a collection of parse tree classes
  26. (in C++), each for a different kind of language construct.  Simulating
  27. this in Ada would require tagged variant records or something, without
  28. behavior attached to each variant.  A more complex data structure is a
  29. control flow graph, with different classes for each kind of CFG node
  30. (e.g. add, branch, merge).  All CFG nodes support a common protocol,
  31. but with widely-varying implementations.  No node knows what kind of
  32. node is its successor or predecessor, only its interface.
  33.  
  34. I see the other side as part of teaching an undergrad compilers
  35. course.  The compiler substrate that the students extend is written in
  36. Ada, and the tagged variants, enums, and case statements that litter
  37. the code are awful.  Adding a few new language constructs would be
  38. simple in an OO implementation but is difficult in this "standard"
  39. implementation.
  40.  
  41. -- Craig Chambers
  42.