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,CP1252 Path: g2news2.google.com!postnews.google.com!18g2000yqa.googlegroups.com!not-for-mail From: =?ISO-8859-1?Q?Hibou57_=28Yannick_Duch=EAne=29?= Newsgroups: comp.lang.ada Subject: Re: Dispatch on the result still does not work? Date: Sat, 11 Jul 2009 04:32:49 -0700 (PDT) Organization: http://groups.google.com Message-ID: <3a2a94a3-91df-411e-b078-498cc7850554@18g2000yqa.googlegroups.com> References: NNTP-Posting-Host: 77.198.58.178 Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1247311969 12708 127.0.0.1 (11 Jul 2009 11:32:49 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Sat, 11 Jul 2009 11:32:49 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: 18g2000yqa.googlegroups.com; posting-host=77.198.58.178; posting-account=vrfdLAoAAAAauX_3XwyXEwXCWN3A1l8D User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; fr),gzip(gfe),gzip(gfe) Xref: g2news2.google.com comp.lang.ada:6978 Date: 2009-07-11T04:32:49-07:00 List-Id: On 11 juil, 12:04, "Dmitry A. Kazakov" wrote: > use P; > > =A0 =A0X : T'Class :=3D S'(Value); > begin > =A0 =A0X :=3D Value; -- Ambiguous? > > I would expect it rather dispatching on the tag of X, i.e. selecting Valu= e, > which returns S. > > -- > Regards, > Dmitry A. Kazakovhttp://www.dmitry-kazakov.de Using this main program: > with P; > procedure Q is > X : P.T'Class :=3D P.S'(P.Value); > begin > X :=3D P.Value; > end; I indeed got an ambiguity error. What was predictable. There is no tagged argument here which controls the dispatching. This is not like some other language which assume an implicite argument. Doing this: > with P; > procedure Q is > X : P.T'Class :=3D P.S'(P.Value); > begin > X :=3D P.T'(P.Value); > end; works fine. But doing so: > with P; > procedure Q is > X : P.T'Class :=3D P.S'(P.Value); > begin > X :=3D P.S'(P.Value); > end; is rejected, whith a reference to RM 5.2(6), which states: > RM 5.2 6 > If the target is of a tagged class-wide type T'Class, > then the expression shall either be dynamically tagged, > or of type T and tag-indeterminate (see 3.9.2). In your example, Value is tag-indeterminate, as there is not tagged argument to control the dispatching (back to the first assertion about the fact). Hint: the ARM excerpt makes a reference to 3.9.2, which is titled =93 Dispatching Operations of Tagged Types =94 and seems indeed worth reading in this purpose. My personal opinion is that there is no trouble here, as there is no tagged type to control the execution. While in the mean time, I understand what you mean : you are consedering the return value target as the out parameter of a procedure. But this is not an out parameter of a procedure, this is a result returned by a function.