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/28 Message-ID: #1/1 X-Deja-AN: 578482914 References: <867lgvs47x.fsf@ppp-112-253.villette.club-internet.fr> 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-28T00:00:00+00:00 List-Id: Laurent Guerby wrote in message <867lgvs47x.fsf@ppp-112-253.villette.club-internet.fr>... >"Vladimir Olensky" writes: > >> The question is : >> >> Why in Ada it is not allowed to extend both public >> and private part of the tagged type at one step ( using >> kind of syntax as in the following example ): >> >> package P is >> >> type T is tagged private; >> >> type T1 is new T with >> record with private >> something: some_type; >> and record; >> >> private >> >> type T is tagged with >> record >> ID : Integer; >> end record; >> >> type T1 is new T with >> record >> thing : some_other_type; >> end record; >> >> end P; > >What about: > > type T1_Private is private; > > type T1 is new T with record > something_public : some_type; > something_private : T1_Private; > end record; > >private > > type T1_Private is record > -- whatever... > end record; > >> It would be interesting to know what were >> the reasons not to allow to have BOTH a record >> extension AND a private extension at the same time. > >Looks like it's easy to emulate, at least in the simple case you >provided. This is not very good as in this case the layout oh the descendant (common part) will be different from the layout of it's private parent type that serves as a common root to several different "children" and some of them may have additional public (visible fields) together with additional private fields. Better way is just to use two extension steps but here we are back to my original question - why it is not allowed to do this in one step as in other OOP languages. Regards, Vladimir Olensky Regards, Vladimir Olensky