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,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.66.150.10 with SMTP id ue10mr7003757pab.43.1436298701864; Tue, 07 Jul 2015 12:51:41 -0700 (PDT) X-Received: by 10.140.95.135 with SMTP id i7mr92532qge.27.1436298701819; Tue, 07 Jul 2015 12:51:41 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!feeder.eternal-september.org!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!wf20no1681735igc.0!news-out.google.com!4ni78132qgh.1!nntp.google.com!w90no1518693qge.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Tue, 7 Jul 2015 12:51:41 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=85.201.165.65; posting-account=6m7axgkAAADBKh082FfZLdYsJ24CXYi5 NNTP-Posting-Host: 85.201.165.65 References: <0ade6abf-34c0-46e2-8bd9-d60a00056321@googlegroups.com> <28d2406c-d579-4710-9b34-108317fe9abf@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <87b318bc-9534-413a-ad3c-dc2a12855ef2@googlegroups.com> Subject: Re: Declaring constants for a abstract tagged type and concrete sub classes From: Serge Robyns Injection-Date: Tue, 07 Jul 2015 19:51:41 +0000 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Xref: news.eternal-september.org comp.lang.ada:26688 Date: 2015-07-07T12:51:41-07:00 List-Id: On Tuesday, 7 July 2015 19:21:46 UTC+2, G.B. wrote: > On 07.07.15 18:27, Serge Robyns wrote: >=20 > > Now I'm facing my other issue, how to "merge" the root and child part i= n a new No_Element ... This is about valid Ada syntax. >=20 > > No_Element : constant T_Concrete :=3D ( T_Root.No_Element, 789); >=20 > If the derived type stays within the package hierarchy, > i.e. in a child package (that's Abstract_Root.No_Element > in the extension aggregate): >=20 > ... > private > No_Element : constant Non_Abstract :=3D > Non_Abstract'(No_Element with > Abc =3D> -42); >=20 This one did the trick! I'm marveled by the syntax and the meaning of the = standalone tick ('). I'm wondering how I'll master these idiosyncrasies. = I've tried to read years back the 95 RM but honestly it isn't bedtime lectu= re. The wiki book is much readable but seems to leave quite some ground un= explored. And I must admit I don't capture the essence of the difference b= etween the above one and below one, except the obvious (variable vs. type) = it puzzles me that it builds a variable out of type definition. > That is, one can start an extension aggregate with > an expression supplying the T_Root stuff from the parent > type. Or, >=20 > ... > private > No_Element : constant Non_Abstract :=3D > Non_Abstract'(T_Root with > Abc =3D> -42); >=20 > where T_Root stands for the type's defaults only. > Outside the hierarchy, that could be >=20 > ... > private > No_Element : constant Non_Abstract :=3D > Non_Abstract'(Abstract_Root.T_Root with > Abc =3D> -42); >=20 > This presumes, then, that no_element-ness is fully determined > by the component Abc here, since Abstract_Root.No_Element's > private view is unavailable outside the package hierarchy > and so can't be depended upon.