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.5 required=3.0 tests=BAYES_50,FREEMAIL_FROM, FROM_STARTS_WITH_NUMS autolearn=no autolearn_force=no version=3.4.5-pre1 X-Received: by 2002:a05:6214:1103:: with SMTP id e3mr302606qvs.12.1614212011910; Wed, 24 Feb 2021 16:13:31 -0800 (PST) X-Received: by 2002:a25:b74d:: with SMTP id e13mr246562ybm.405.1614212011583; Wed, 24 Feb 2021 16:13:31 -0800 (PST) Path: eternal-september.org!reader02.eternal-september.org!news.dns-netz.com!news.freedyn.net!newsreader4.netcologne.de!news.netcologne.de!peer01.ams1!peer.ams1.xlned.com!news.xlned.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Wed, 24 Feb 2021 16:13:31 -0800 (PST) In-Reply-To: Injection-Info: google-groups.googlegroups.com; posting-host=82.154.188.98; posting-account=rhqvKAoAAABpikMmPHJSZh4400BboHwT NNTP-Posting-Host: 82.154.188.98 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> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <10e39f4a-9253-4faf-93af-b57ccad92526n@googlegroups.com> Subject: Re: "unconstrained subtype in component declaration" vs "discriminant in constraint must appear alone" From: Mehdi Saada <00120260a@gmail.com> Injection-Date: Thu, 25 Feb 2021 00:13:31 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Received-Bytes: 3223 Xref: reader02.eternal-september.org comp.lang.ada:61438 List-Id: Okay, point by point. type Cards_number is range 0..52; sorry lingering French > type CARDS is new cards_numbers range 1..52; > when 1 =3D> put("Spades"); > when 2 =3D> put("Hearts"); > when 3 =3D> put("diamonds"); > when 4 =3D> put("clubs"); > end case; I didn't know half the terms in English. Nor that it was called a "suit"...= I read novels but simple terms like this, nope.. > type Cards_Numbers'Base is range /implementation_defined/; > type Cards'Base is new Cards_Numbers'Base; I didn't get the meaning of 'Base before. ok. > Note also that 52 / 13 + 1 =3D 5. > If you write what you mean, you would have Yes... I prefered being looking in the mirror and seeing a smartass with a = math expression, to get myself ridiculous here, writing it wrong. Ignoring this, could the compiler see that the expression has a limited num= ber of possible results ? or a side tool ? Never make it complicated and mathematics when it can be static and plain. = Ok. Morale: I have trouble not choosing names in a sorely confusing =C3=B0=C3= =A6=C2=B5ning way, even with care, =C4=91=E2=86=93=C2=A2=C4=B8, =C3=9F=C4= =A7=E2=86=92=C5=A7 ! > Yeah, here you're straight-up trying to overwrite the discriminant. But I'm assigning a record aggregate to a mutable type object (so with a de= fault disciminant). So why does it matter if the component's subtype is constrained (here by th= e discriminant, but whatever) ? It's the very point of mutable objects, to cope with these assignments... o= r What am I missing ? That's the last issue remaining.