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,FREEMAIL_FROM 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!h2g2000yqg.googlegroups.com!not-for-mail From: sjw Newsgroups: comp.lang.ada Subject: Re: Dispatch on the result still does not work? Date: Tue, 14 Jul 2009 14:06:42 -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: 82.20.239.89 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1247605602 24364 127.0.0.1 (14 Jul 2009 21:06:42 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Tue, 14 Jul 2009 21:06:42 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: h2g2000yqg.googlegroups.com; posting-host=82.20.239.89; posting-account=_RXWmAoAAADQS3ojtLFDmTNJCT0N2R4U User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_7; en-us) AppleWebKit/530.19.2 (KHTML, like Gecko) Version/4.0.2 Safari/530.19,gzip(gfe),gzip(gfe) Xref: g2news2.google.com comp.lang.ada:7055 Date: 2009-07-14T14:06:42-07:00 List-Id: On Jul 13, 11:50=A0pm, Adam Beneschan wrote: > On Jul 13, 2:47=A0pm, sjw wrote: > > 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. =A0The 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. =A0It will always call > the Value that returns S. =A0(Putting the dispatching operation inside a > type conversion will kill any dispatching---see 3.9.2(17-19).) =A0And, > in this case, it will result in a Constraint_Error at runtime since X > is now constrained to values of type T. Exception name: CONSTRAINT_ERROR Message: dmitry.ada:26 tag check failed I was entertained by this: X : P.T'Class :=3D P.S'(P.Value); begin X :=3D P.T'(P.Value); where P.T'(P.Value) dispatched to the S version (in other words the actual (dynamic?) type of the target was controlling).