home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky comp.lang.ada:3273 comp.object:4224
- Newsgroups: comp.lang.ada,comp.object
- Path: sparky!uunet!charon.amdahl.com!pacbell.com!sgiblab!zaphod.mps.ohio-state.edu!rpi!batcomputer!cornell!uw-beaver!klamath.cs.washington.edu!chambers
- From: chambers@klamath.cs.washington.edu (Craig Chambers)
- Subject: Re: OOD, Ada, and Inheritance
- Message-ID: <1992Nov13.224508.18746@beaver.cs.washington.edu>
- Sender: news@beaver.cs.washington.edu (USENET News System)
- Reply-To: chambers@cs.washington.edu
- Organization: University of Washington
- 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>
- Date: Fri, 13 Nov 92 22:45:08 GMT
- Lines: 28
-
- In article <1992Nov13.203723.26049@cis.ohio-state.edu>, weide@elephant.cis.ohio-state.edu (Bruce Weide) writes:
- |> ...
- |> Or, by multiple implementations, do you mean to insist on run-time
- |> selection among different implementations? If so, what examples would
- |> you (e.g., Ralph, or others holding this view) consider to be "good"
- |> examples of the use of inheritance for this purpose; to be contrasted
- |> with Rosen's examples, which are criticized as unrepresentative of
- |> good OO practices?
-
- In my implementation of the Self compiler, I use "run-time selection
- among different implementation" to good effect in several data
- structures. One of the simplest is a collection of parse tree classes
- (in C++), each for a different kind of language construct. Simulating
- this in Ada would require tagged variant records or something, without
- behavior attached to each variant. A more complex data structure is a
- control flow graph, with different classes for each kind of CFG node
- (e.g. add, branch, merge). All CFG nodes support a common protocol,
- but with widely-varying implementations. No node knows what kind of
- node is its successor or predecessor, only its interface.
-
- I see the other side as part of teaching an undergrad compilers
- course. The compiler substrate that the students extend is written in
- Ada, and the tagged variants, enums, and case statements that litter
- the code are awful. Adding a few new language constructs would be
- simple in an OO implementation but is difficult in this "standard"
- implementation.
-
- -- Craig Chambers
-