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=-1.3 required=5.0 tests=BAYES_00,FREEMAIL_FROM, INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,fa2cc518ef3b992c X-Google-Attributes: gid103376,public From: "Vladimir Olensky" Subject: Re: tagged types extensions - language design question Date: 2000/01/31 Message-ID: #1/1 X-Deja-AN: 579858213 References: <867lgvs47x.fsf@ppp-112-253.villette.club-internet.fr> <38918156.7C35@nospam.com.tj> <3892BABB.290D@nospam.com.tj> Organization: Posted via Supernews, http://www.supernews.com X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3 Newsgroups: comp.lang.ada X-Complaints-To: newsabuse@supernews.com Date: 2000-01-31T00:00:00+00:00 List-Id: Andy wrote in message <3892BABB.290D@nospam.com.tj>... >Although it is good practice to have each child class type in its >own package, if the intermediate type is just to allow a double >extension (one public, one private), why not just do so in the one >package, something like: > >-- Root class >-- >package P1 is > type Root is abstract tagged null record; > procedure Method (X : in Root) is abstract; >end P1; > >-- Child class >-- >package P1.P2 is > > -- public extension > -- this is abstract so we don't have to override any > -- abstract operations defined by the paraent class. > -- > type Intermediates is abstract new P1.Root with record > F : Float; -- etc. > end record; > > type Objects is new Intermediates with private; > > procedure Method (X : in Objects); > >private > > type Objects is new Intermediates with record > I : Integer; -- etc. > end record; > >end P1.P2; Yes, that's fine. Creating one intermediate type with public attributes is not a big deal. It looks strange at first glance that one can not extend both public and private part in one step but then one get used to it and it does not seem to be a problem any more. Regards, Vladimir Olensky