From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,3ef3e78eacf6f938 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII Path: g2news2.google.com!postnews.google.com!a37g2000prf.googlegroups.com!not-for-mail From: Adam Beneschan Newsgroups: comp.lang.ada Subject: Re: Making a nonlimited type controlled by means of a controlled component Date: Fri, 14 Aug 2009 15:51:59 -0700 (PDT) Organization: http://groups.google.com Message-ID: <1554852d-c3ea-4d65-8aa6-1cb71f415d7f@a37g2000prf.googlegroups.com> References: <31bb0f0b-9655-4bda-81c3-e8f7855a1ee9@c14g2000yqm.googlegroups.com> NNTP-Posting-Host: 66.126.103.122 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1250290320 29723 127.0.0.1 (14 Aug 2009 22:52:00 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Fri, 14 Aug 2009 22:52:00 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: a37g2000prf.googlegroups.com; posting-host=66.126.103.122; posting-account=duW0ogkAAABjRdnxgLGXDfna0Gc6XqmQ User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; WOW64; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.5.21022; .NET CLR 3.5.30729; .NET CLR 3.0.30618),gzip(gfe),gzip(gfe) Xref: g2news2.google.com comp.lang.ada:7806 Date: 2009-08-14T15:51:59-07:00 List-Id: On Aug 14, 3:21=A0pm, "Randy Brukardt" wrote: > > Randy, do you have an opinion on this, or should I raise the problem > > with the ARG? > > I'm not sure. The problem is that the assignment ought to raise > Constraint_Error, because the discriminants don't match, and the componen= ts > are constrained: > > =A0 =A0X :=3D Y; -- Ought to raise Constraint_Error. > > =A0 =A0X.C.Enclosing =3D X'Access > =A0 =A0Y.C.Enclosing =3D Y'Access > > But I'm not sure if the language actually requires making such a check > (generally, implementations assume that the constraints on subcomponents > have to be OK - whether the language says this or not I'm not sure). I looked over the Dynamic Semantics of assignment, and I don't think there's anything in the language that requires a check. The value is converted to the target's subtype, which doesn't do anything here since the source and target have the same subtypes (obviously if T were a discriminated type, this conversion would check the discriminant, but it isn't). Then the converted value "becomes" the value of the target. I don't see anything to the effect that assignment of a record recursively involves "assignment" of the components; it seems to work on the entire record only. So this looks like an error in the language to me. -- Adam