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=-0.5 required=3.0 tests=BAYES_05,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.5-pre1 X-Received: by 2002:ac8:5750:: with SMTP id 16mr57110885qtx.305.1609417464037; Thu, 31 Dec 2020 04:24:24 -0800 (PST) X-Received: by 2002:a25:5086:: with SMTP id e128mr80531298ybb.309.1609417463814; Thu, 31 Dec 2020 04:24:23 -0800 (PST) Path: eternal-september.org!reader02.eternal-september.org!news.uzoreto.com!tr3.eu1.usenetexpress.com!feeder.usenetexpress.com!tr2.iad1.usenetexpress.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Thu, 31 Dec 2020 04:24:23 -0800 (PST) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: google-groups.googlegroups.com; posting-host=84.209.88.37; posting-account=bPTmZAoAAAC_6HP9XLKB9aAAxBa6BuOR NNTP-Posting-Host: 84.209.88.37 References: <3c1a2fe9-e8f2-401f-870d-aecd9e0f9c69n@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <6dd44b3c-b3de-4943-ac70-0e25eaf279efn@googlegroups.com> Subject: Re: Question on variant/discriminated records From: reinert Injection-Date: Thu, 31 Dec 2020 12:24:24 +0000 Content-Type: text/plain; charset="UTF-8" Xref: reader02.eternal-september.org comp.lang.ada:60986 List-Id: Here must be a hole in my understanding. I thought that the discriminant must be known before V.Y := 1.0; and hence there should be no confusion? reinert torsdag 31. desember 2020 kl. 11:52:26 UTC+1 skrev J-P. Rosen: > Yes, it is a rule that identifiers in parallel branches cannot be > identical. And there is a good reason for this: in Ada, when you access > a component, the compiler checks that the component exists, according to > the value of the discriminant. Assume that you write (if V is of type > rec1_type): > V.Y := 1.0; > > If both components are named Y, should the discriminant be B or C? > -- > J-P. Rosen > Adalog > 2 rue du Docteur Lombard, 92441 Issy-les-Moulineaux CEDEX > Tel: +33 1 45 29 21 52, Fax: +33 1 45 29 25 00 > http://www.adalog.fr