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 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,14fb9d67ad36043 X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!eweka.nl!lightspeed.eweka.nl!feeder3.cambrium.nl!feeder2.cambrium.nl!feeder5.cambrium.nl!feed.tweaknews.nl!not-for-mail From: Ludovic Brenta Newsgroups: comp.lang.ada Subject: Re: Object.Operation and child package References: Date: Wed, 25 Jun 2008 20:40:44 +0200 Message-ID: <87vdzx9x3n.fsf@ludovic-brenta.org> User-Agent: Gnus/5.110006 (No Gnus v0.6) Emacs/21.4 (gnu/linux) Cancel-Lock: sha1:LPmUcGhp6lbst8AwKK3Ahyfg1Ms= MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Organization: Tele2 X-Trace: DXC=]:`i7Q;]9cJNXN@RReQ2NF6`Y6aWje^YJW0HBYNnY5dCJ^hai9M\[kDHP9N]mUIGFL`A:YQHf056G Xref: g2news1.google.com comp.lang.ada:881 Date: 2008-06-25T20:40:44+02:00 List-Id: pascal.malaise@gmail.com writes: > Hi Ada05 experts, > > Is it normal to reject compilation of Object.Operation notation when > operation is in a child package: > > package Pack is > type Typ is tagged null record; > procedure Proc1 (Var : in Typ); > end Pack; > > package Pack.Sub is > procedure Proc2 (Var : in Typ); > end Pack.Sub; > > with Pack.Sub; > procedure Proc is > Obj : Pack.Typ; > begin > Obj.Proc1; > Obj.Proc2; > end Proc; > > The second call does not compile (with gnat): > proc.adb:6:04: no selector "Proc2" for type "Typ" defined at pack.ads: > 3 Yes, this is normal because Proc2 is not a primitive operation of Typ (or, in other words, it is not a method of Typ). A primitive operation, by definition, is declared in the same package as its type. So, in this situation, the only way to call Proc2 is with the traditional notation: Pack.Sub.Proc2 (Obj); -- Ludovic Brenta.