From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.5-pre1 (2020-06-20) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-0.9 required=3.0 tests=BAYES_00,FROM_ADDR_WS autolearn=no autolearn_force=no version=3.4.5-pre1 Date: 13 Nov 92 22:45:08 GMT From: klamath.cs.washington.edu!chambers@beaver.cs.washington.edu (Craig Chamb ers) Subject: Re: OOD, Ada, and Inheritance Message-ID: <1992Nov13.224508.18746@beaver.cs.washington.edu> List-Id: 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