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.9 required=5.0 tests=BAYES_00, T_FILL_THIS_FORM_SHORT autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,4f325eb9bb392b2f X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2000-09-05 22:27:09 PST Path: supernews.google.com!sn-xit-02!sn-east!sn-xit-uk!supernews.com!193.162.153.122.MISMATCH!news.tele.dk!195.64.68.27!newsgate.cistron.nl!bullseye.news.demon.net!demon!news.demon.co.uk!demon!pogner.demon.co.uk!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: Delegating operations to parent (generic formal type) Date: 06 Sep 2000 06:25:47 +0100 Organization: At Home Message-ID: References: <39AC2C1B.FFA2E69C@averstar.com> NNTP-Posting-Host: localhost X-NNTP-Posting-Host: pogner.demon.co.uk:158.152.70.98 X-Trace: news.demon.co.uk 968217983 nnrp-12:7183 NO-IDENT pogner.demon.co.uk:158.152.70.98 X-Complaints-To: abuse@demon.net X-Newsreader: Gnus v5.5/Emacs 20.3 Xref: supernews.google.com comp.lang.ada:512 Date: 2000-09-06T06:25:47+01:00 List-Id: Tucker Taft writes: > The use of Initialize is legal. This looks like an old-fashioned > bug in APEX and ObjectAda 7.2. The current AdaMagic front end has no > problem "seeing" the Initialize operation. Tucker, Thanks very much. I'll pass on PRs .. The following is a repost of my article "Visibility for operations of formal private extensions" which seems to have similar difficulty. I'd be most grateful for any comments .. The code below gives compilation errors when compiling the view conversion in P.Q.R.Proc's body, both in GNAT (3.13a1) and Apex 3.2.0b. They say that there's no visible interpretation: GNAT says /home/simon/tmp/demo.ada:33:09: no candidate interpretations match the actuals: /home/simon/tmp/demo.ada:33:15: expected type "New_T" defined at /home/simon/tmp/demo.ada:26 /home/simon/tmp/demo.ada:33:15: found private type "Base" defined at /home/simon/tmp/demo.ada:22 /home/simon/tmp/demo.ada:33:15: ==> in call to "Proc" at /home/simon/tmp/demo.ada:27 /home/simon/tmp/demo.ada:33:15: ==> in call to "Proc" at /home/simon/tmp/demo.ada:18(inherited) /home/simon/tmp/demo.ada:33:15: ==> in call to "Proc" at /home/simon/tmp/demo.ada:5 If I make P.Proc publicly visible, the compilation goes fine. I believe we are somewhere near 12.5.1(21) here. My belief that it should have compiled is based on the following: * we know that P.Q.R.Base is a P.Q.Q_T * a P.Q.Q_T (privately) inherits P.Proc * P.Q.R's body has visiblity of the private part of P and therefore should be able to see that P.Q.Q_T inherits P.Proc Note that P.Q.S's body _can_ see P.Proc. I tried adding a private component to P.Q.Q_T, P.Q.R.Proc can see it quite happily .. OK, the LRM reference above is about operations not data, still! ================================================================== package P is type T is tagged private; private type T is tagged null record; procedure Proc (The_T : in out T); end P; package body P is procedure Proc (The_T : in out T) is begin null; end Proc; end P; package P.Q is type Q_T is new P.T with private; private type Q_T is new T with null record; end P.Q; generic type Base is new Q_T with private; package P.Q.R is type New_T is new Base with private; private type New_T is new Base with null record; procedure Proc (The_T : in out New_T); end P.Q.R; package body P.Q.R is procedure Proc (The_T : in out New_T) is begin Proc (Base (The_T)); end Proc; end P.Q.R; package P.Q.S is type S_T is new Q_T with private; private type S_T is new Q_T with null record; procedure Proc (The_T : in out S_T); end P.Q.S; package body P.Q.S is procedure Proc (The_T : in out S_T) is begin Proc (Q_T (The_T)); end Proc; end P.Q.S; with P.Q.R; with P.Q.S; package U is package U_P is new P.Q.R (Base => P.Q.S.S_T); end U;