From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.5-pre1 (2020-06-20) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-1.9 required=3.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.5-pre1 X-Received: by 2002:a37:9f89:: with SMTP id i131mr1439333qke.160.1616437383223; Mon, 22 Mar 2021 11:23:03 -0700 (PDT) X-Received: by 2002:a25:ae8c:: with SMTP id b12mr1119879ybj.173.1616437383007; Mon, 22 Mar 2021 11:23:03 -0700 (PDT) Path: eternal-september.org!reader02.eternal-september.org!news.uzoreto.com!2.eu.feeder.erje.net!feeder.erje.net!newsfeed.xs4all.nl!newsfeed8.news.xs4all.nl!feeder1.cambriumusenet.nl!feed.tweak.nl!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Mon, 22 Mar 2021 11:23:02 -0700 (PDT) In-Reply-To: Injection-Info: google-groups.googlegroups.com; posting-host=2601:3c3:401:f550:9ee:b41e:1376:69a6; posting-account=JSxOkAoAAADa00TJoz2WZ_46XrZCdXeS NNTP-Posting-Host: 2601:3c3:401:f550:9ee:b41e:1376:69a6 References: <07a56dcc-9e17-49b2-a980-3a5a2d265cedn@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <3fb9acf6-cf8b-4199-aca8-28d6ff60d63dn@googlegroups.com> Subject: Re: Performance of records with variant parts From: John Perry Injection-Date: Mon, 22 Mar 2021 18:23:03 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Xref: reader02.eternal-september.org comp.lang.ada:61637 List-Id: On Monday, March 22, 2021 at 1:07:02 PM UTC-5, Dmitry A. Kazakov wrote: > On 2021-03-22 18:45, John Perry wrote:=20 > > On Monday, March 22, 2021 at 12:39:54 PM UTC-5, Dmitry A. Kazakov wrote= :=20 > >> It must check the discriminant if the object is dynamically constraine= d.=20 > >=20 > > I'm not quite sure I understand. Are you saying that it has to check th= e discriminant at run-time? > Yes, if the field is in the variant part and the discriminant cannot be= =20 > statically deduced to indicate that part [or not, so that it could=20 > always raise Constraint_Error] I think I understand that, but the check for "obj.kind" is there in both ve= rsions of the code. Isn't that a dynamic check even when I use a non-varian= t record? What's the difference in the check when I'm checking the discrimi= nant of a variant record and the value of a field? (Sorry if I'm not expressing myself well.) > > How would that differ from checking the value if it were merely a field= of the record? > The field is always there. I think if you made it an Unchecked_Union you= =20 > would have no penalty (and no safety). ...and no access to check obj.kind, either :-( john perry