From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=BAYES_00,INVALID_DATE autolearn=no autolearn_force=no version=3.4.4 Path: utzoo!news-server.csri.toronto.edu!cs.utexas.edu!usc!snorkelwacker.mit.edu!bu.edu!inmet!stt From: stt@inmet.inmet.com Newsgroups: comp.lang.ada Subject: Re: layering with discriminants Message-ID: <20600087@inmet> Date: 6 Mar 91 20:12:00 GMT References: <90348@tut.cis.ohio-state.edu> Nf-ID: #R:tut.cis.ohio-state.edu:90348:inmet:20600087:000:1501 Nf-From: inmet.inmet.com!stt Mar 6 15:12:00 1991 List-Id: In article <44963@ut-emx.uucp> hasan@emx.utexas.edu (David A. Hasan) writes: . . . >My problem revolves around the fact that the DEC compiler rejects >the presence of the discriminant in the full declaration of the adt in >the private part of g_highLevel, since the declaration is not a record. >But the declaration is *derived* from a record. >My conclusion is that it is not legal to derive >types with discriminants from parents with discriminants. >If this is true, is there anyway to achieve an equivalent effect? This is true, and it is admittedly annoying. One way is to make the private type into a record containing the parent as a component. Some compilers are clever enough to share the space occupied by the component's discriminants for the enclosing record's discriminants (since they must always have the same value). For example: type Blah(X : Integer) is private; private type Blah(X : Integer) is record Parent : Parent_Type(X); end record; -S. Tucker Taft Ada 9X Mapping/Revision Team Intermetrics, Inc. Cambridge, MA 02138 P.S. This annoyance has been identified as something which might be fixable in Ada 9X without too much change, perhaps by allowing: type Blah(X : Integer) is new Parent_Type(X); in the private part which would make Blah be a derivative of Parent_Type, but also allow the declaration to fulfill "type Blah(X : Integer) is private;" It is too early to tell whether such a proposal will survive the 9X review process.