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.190.41 with SMTP id gn9mr1087194pac.2.1436217389933; Mon, 06 Jul 2015 14:16:29 -0700 (PDT) X-Received: by 10.140.47.68 with SMTP id l62mr15302qga.42.1436217389887; Mon, 06 Jul 2015 14:16:29 -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!news.glorb.com!qs7no1285519igc.0!news-out.google.com!4ni69138qgh.1!nntp.google.com!m107no791708qgd.1!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Mon, 6 Jul 2015 14:16:29 -0700 (PDT) In-Reply-To: <87lhetb4oh.fsf@theworld.com> 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> <66fa1189-9c51-4290-be53-6f3c40545ce7@googlegroups.com> <87lhetb4oh.fsf@theworld.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <951038e0-77d0-43b2-aead-ad18cb09ecf5@googlegroups.com> Subject: Re: Declaring constants for a abstract tagged type and concrete sub classes From: Serge Robyns Injection-Date: Mon, 06 Jul 2015 21:16:29 +0000 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Xref: news.eternal-september.org comp.lang.ada:26665 Date: 2015-07-06T14:16:29-07:00 List-Id: On Monday, 6 July 2015 19:02:13 UTC+2, Bob Duff wrote: > Serge Robyns <> writes: >=20 > > type T_Root ... > > No_Root_Element : T_Root :=3D (a, b, c); > > > > type T_Sub is new T_Root .... > > No_Sub_Element : T_Sub :=3D ( ??? No_Root_Element ???, x, y z); >=20 > One possibility is to declare T_Root with default values for the > components, such that those defaults are what you want for a "No_...". > Then you can do: >=20 > No_Sub_Element : T_Sub :=3D (T_Root with X =3D> X, Y =3D> Y, Z =3D> Z= ); >=20 > Or if T_Sub also has meaningful defaults, then: >=20 > No_Sub_Element : T_Sub :=3D (T_Root with others =3D> <>); >=20 > I don't much like using default values, but in this kind of case > it might be the best choice. >=20 > - Bob I agree with you I don't like using default values as they will always init= ialize variables, even if they will be assigned some other values later. F= or the moment (in my prototype) they are useful as not all data is yet usef= ul populated. One thing I'm still very much puzzled is the use of "<>" at many places. I= 'm fine with it in generics, but failed to understand in class declaration = or your assignment examples. Looks like I failed to understand some chapte= rs. I did google to understand their use in abstract tagged types (found a= n example of a Virtual Proxy example in Ada using that kind of construct). Serge