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,f857f366542cd8aa X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII Path: g2news2.google.com!postnews.google.com!v15g2000prn.googlegroups.com!not-for-mail From: Adam Beneschan Newsgroups: comp.lang.ada Subject: Re: Dispatch on the result still does not work? Date: Mon, 13 Jul 2009 15:50:27 -0700 (PDT) Organization: http://groups.google.com Message-ID: References: <4a58dfcf$0$30232$9b4e6d93@newsspool1.arcor-online.net> <1rfyxeircfmy1.19a1j3vqyttbo$.dlg@40tude.net> <74j6m.69502$rO.69160@newsfe13.ams2> <1u2c96ysoamp2.1vn3copqwfld7$.dlg@40tude.net> <874fde27-bd71-4d8b-adad-072817790373@d34g2000vbm.googlegroups.com> <71bb67c1-e641-4b11-a48d-ecfd90640a5b@33g2000vbe.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 1247525428 5270 127.0.0.1 (13 Jul 2009 22:50:28 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Mon, 13 Jul 2009 22:50:28 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: v15g2000prn.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:7039 Date: 2009-07-13T15:50:27-07:00 List-Id: On Jul 13, 2:47=A0pm, sjw wrote: > On Jul 13, 5:55=A0pm, Adam Beneschan wrote: > > > On Jul 12, 1:30=A0pm, sjw wrote: > > > saying 'tag-indeterminate expression must have type "T"(RM 5.2 (6))' > > > No, that's not a GNAT problem. =A0The RM paragraph, which GNAT was good > > enough to tell you about, specifically says that a tag-indeterminate > > expression must have type T in this case. =A0I kind of think that if a > > GNAT error message refers to a specific RM passage, it's probably a > > good idea to read that passage before assuming there's a GNAT > > problem..... > > OK, mea culpa. However .. if I say P.S'(whatever) and the compiler > tells me it's tag-indeterminate my first reaction is that it must be > confused! Yeah, I can understand why this could be confusing. The qualifier P.S' doesn't say that the expression in parentheses will (dynamically) have type P.S; it says that the operand must resolve to be of the type P.S, which, I believe, implies that the expression's type will actually be P.S **except** when dispatching is involved. > If I hadn't been too taken with the symmetry I'd have realised that I > should have written > > procedure Q is > =A0 =A0X : P.T'Class :=3D P.T'(P.Value); > begin > =A0 =A0X :=3D P.T'Class (P.S'(P.Value)); > > (which (I think) is the 'dynamically tagged' alternative in 5.2(6) > which wasn't mentioned by GNAT). I think this will work, but it will not dispatch. It will always call the Value that returns S. (Putting the dispatching operation inside a type conversion will kill any dispatching---see 3.9.2(17-19).) And, in this case, it will result in a Constraint_Error at runtime since X is now constrained to values of type T. -- Adam