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.0 required=3.0 tests=BAYES_20,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.5-pre1 X-Received: by 2002:ad4:4e8a:: with SMTP id dy10mr60689676qvb.14.1609419448723; Thu, 31 Dec 2020 04:57:28 -0800 (PST) X-Received: by 2002:a25:7449:: with SMTP id p70mr76478794ybc.363.1609419448601; Thu, 31 Dec 2020 04:57:28 -0800 (PST) Path: eternal-september.org!reader02.eternal-september.org!news.uzoreto.com!newsfeed.xs4all.nl!newsfeed9.news.xs4all.nl!tr3.eu1.usenetexpress.com!feeder.usenetexpress.com!tr1.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:57:28 -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> <6dd44b3c-b3de-4943-ac70-0e25eaf279efn@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <8357b686-38f0-41c6-ab29-6b453e32e092n@googlegroups.com> Subject: Re: Question on variant/discriminated records From: reinert Injection-Date: Thu, 31 Dec 2020 12:57:28 +0000 Content-Type: text/plain; charset="UTF-8" Xref: reader02.eternal-september.org comp.lang.ada:60989 List-Id: Approaching :-) But the interpretation of (the meaning of) r.y could in principle be calculated on the fly (when called) based on the received discriminant - but arguments related to security/reliability are against? Maybe nice to find errors at compile time as compared to experiencing costly runtime errors :-) reinert torsdag 31. desember 2020 kl. 13:46:47 UTC+1 skrev gautier: > On Thursday, December 31, 2020 at 1:24:25 PM UTC+1, reinert wrote: > > 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? > Imagine you have a function Evaluate (r : rec1_Type) return Float. > Except in trivial cases like > if r.option1 = b then result := result + r.y; end if; > the compiler cannot guess the value of the discriminant.