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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.5-pre1 X-Received: by 2002:a05:620a:2908:: with SMTP id m8mr1773583qkp.24.1614243525676; Thu, 25 Feb 2021 00:58:45 -0800 (PST) X-Received: by 2002:a25:268c:: with SMTP id m134mr2781555ybm.253.1614243525495; Thu, 25 Feb 2021 00:58:45 -0800 (PST) Path: eternal-september.org!reader02.eternal-september.org!news.uzoreto.com!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: Thu, 25 Feb 2021 00:58:45 -0800 (PST) In-Reply-To: <10e39f4a-9253-4faf-93af-b57ccad92526n@googlegroups.com> Injection-Info: google-groups.googlegroups.com; posting-host=94.31.102.170; posting-account=rmHyLAoAAADSQmMWJF0a_815Fdd96RDf NNTP-Posting-Host: 94.31.102.170 References: <4086f350-c56b-4eec-91d3-ef685230b011n@googlegroups.com> <67ea71d9-489a-4802-9cf0-d955f6ecce62n@googlegroups.com> <0e88c615-6a53-4392-b83d-581c59473c88n@googlegroups.com> <6716a4e5-02ac-4735-83c9-28bff3f8aae6n@googlegroups.com> <10e39f4a-9253-4faf-93af-b57ccad92526n@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: "unconstrained subtype in component declaration" vs "discriminant in constraint must appear alone" From: AdaMagica Injection-Date: Thu, 25 Feb 2021 08:58:45 +0000 Content-Type: text/plain; charset="UTF-8" Xref: reader02.eternal-september.org comp.lang.ada:61440 List-Id: 0012...@gmail.com schrieb am Donnerstag, 25. Februar 2021 um 01:13:32 UTC+1: > But I'm assigning a record aggregate to a mutable type object (so with a default disciminant). > So why does it matter if the component's subtype is constrained (here by the discriminant, but whatever) ? > It's the very point of mutable objects, to cope with these assignments... or What am I missing ? > That's the last issue remaining. First a word to your attitude. You ask us a favour to look at your code. That's OK and you're welcome. But: You ask us to do some work for you. Then may we not expect that you do your work before? What is your work? Provide a complete compilable reproducer. Write it in a consitent and readable style. Is this expectation on our side really too much? > type Sets_of_Card is array (Nombre_cartes range <>) of Cards; > type CARDS_SETS (Nb: Nombre_cartes := 0) is record > Set: Sets_of_Card (1..Nb) := INITIALIZATION (Nb); > end record; > PACK := (pack.nb-1, Pack.Set(pack.set'First..Pack.Nb-1)); This line by itself is not the problem IF Pack really is mutable. declare Pack: Cards_Set := ...; -- mutable object (no discriminant given in declaration) begin PACK := (pack.nb-1, Pack.Set(pack.set'First..Pack.Nb-1)); -- this is OK, no Constraint_Error end; declare Pack: Cards_Set (52) := ...; -- immutalbe object (discriminant given in declaration) begin PACK := (pack.nb-1, Pack.Set(pack.set'First..Pack.Nb-1)); -- Constraint_Error (discriminant check) end;