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=-2.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI autolearn=unavailable autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,4c9e8467ab75bb40 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2004-03-08 23:00:57 PST Path: archiver1.google.com!news2.google.com!news.maxwell.syr.edu!fr.ip.ndsoftware.net!teaser.fr!usenet-fr.net!enst.fr!melchior!cuivre.fr.eu.org!melchior.frmug.org!not-for-mail From: christoph.grein@eurocopter.com Newsgroups: comp.lang.ada Subject: Re: Derived types, private parts, abstract subprograms Date: Tue, 9 Mar 2004 07:53:12 +0100 (MET) Organization: Cuivre, Argent, Or Message-ID: Reply-To: grein@egypt.otn.eurocopter.de NNTP-Posting-Host: lovelace.ada-france.org Mime-Version: 1.0 Content-Type: TEXT/plain; charset=us-ascii X-Trace: melchior.cuivre.fr.eu.org 1078815582 28274 212.85.156.195 (9 Mar 2004 06:59:42 GMT) X-Complaints-To: usenet@melchior.cuivre.fr.eu.org NNTP-Posting-Date: Tue, 9 Mar 2004 06:59:42 +0000 (UTC) To: comp.lang.ada@ada-france.org Return-Path: X-Authentication-Warning: mail.eurocopter.com: uucp set sender to using -f Content-MD5: Hqv9YGjBde+NRx7uk1CkyA== X-Mailer: dtmail 1.3.0 @(#)CDE Version 1.4.8 SunOS 5.8 sun4u sparc X-Virus-Scanned: by amavisd-new-20030616-p7 (Debian) at ada-france.org X-BeenThere: comp.lang.ada@ada-france.org X-Mailman-Version: 2.1.4 Precedence: list List-Id: "Gateway to the comp.lang.ada Usenet newsgroup" List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Xref: archiver1.google.com comp.lang.ada:6174 Date: 2004-03-09T07:53:12+01:00 I amended your example a bit. > package pak1 is > type T1 is abstract tagged null record; > procedure Operation (X : T1) is abstract; > end pak1; > > with pak1; > package pak2 is > type T2 is new pak1.T1 with null record; > private > procedure Operation (X : T2); > end pak2; with pak1; package pak2P is type T2 is private; private type T2 is new pak1.T1 with null record; procedure Operation (X : T2); end pak2P; > package pak3 is > procedure Foo; > end pak3; > > with pak2, pak2P; > package body pak3 is > type T3 is new pak2.T2 with null record; > > procedure Foo is > X : T3; Y : pak2P.T; > begin > Operation (X); --legal? (yes, because T2 is visibly derived -- from T1 Operation (Y); -- illegal (not visible, because T2 is not visibly -- derived from T1 > end Foo; > > end pak3; My interpretation is that it is irrelevant whether inherited primitives are overridden visibly or not if only the type is visibly derived. It matters of course if the type is invisibly derived. package P is type T is tagged ... procedure Prim (X: T; I: Integer := 5); end P; with P; package P1 is type T1 is new P.T with ... private procedure Prim (Y: T1; I: Integer := -5); end P1; In this example, Prim applied to a value of type T1 uses different default values for I depending on whether the overriding is visible or not. Also named association for the first parameter has to use different names. And IMHO it's irrelevant whether the ancestor of Prim is abstract or not. Thus: with P1; procedure M is -- cannot see the private part Ob: P1.T1; begin P1.Prim (X => Ob); -- uses I => 5 end M; procedure P1.M is -- bodies of children see the private parts of parents Ob: P1.T1; begin P1.Prim (Y => Ob); -- uses I => -5 end P1.M; Gnat 3.16a compiles this OK and uses the correct default, alas Apex 3.2.0b reports an error on parameter name Y and uses the wrong default.