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!q40g2000prh.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 08:17:07 -0700 (PDT) Organization: http://groups.google.com Message-ID: <5607cc53-7266-4552-a53a-6d9c6fcc5942@q40g2000prh.googlegroups.com> References: <9f845311-63a4-4d89-ac78-b6567b999417@d4g2000prc.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 1247498228 19370 127.0.0.1 (13 Jul 2009 15:17:08 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Mon, 13 Jul 2009 15:17:08 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: q40g2000prh.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:7028 Date: 2009-07-13T08:17:07-07:00 List-Id: On Jul 13, 8:13=A0am, Adam Beneschan wrote: > On Jul 11, 3:04=A0am, "Dmitry A. Kazakov" > wrote: > > > > > > > Considering this one: > > > package P is > > =A0 =A0type T is tagged null record; > > =A0 =A0function Value return T; > > > =A0 =A0type S is new T with null record; > > =A0 =A0function Value return S; > > end P; > > > package body P is > > =A0 =A0function Value return T is > > =A0 =A0begin > > =A0 =A0 =A0 return (null record); > > =A0 =A0end Value; > > > =A0 =A0function Value return S is > > =A0 =A0begin > > =A0 =A0 =A0 return (T with null record); > > =A0 =A0end Value; > > end P; > > > 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 Va= lue, > > which returns S. > > The problem here (I mean the problem with your program, not a problem > with the Ada language) is that the overloading rules, which determine > what the meaning of the identifier "Value" is when there is more than > one possibility, do not take the dynamic semantics into account. =A0The > overloading rules basically work like this: We consider all possible > combinations of all possible meanings of the identifiers, then keep > only the legal ones (legal according to the "legality rules"; Technically, that should have read 'legal according to the "Name Resolution Rules"'. The rules listed as Legality Rules in the RM aren't even considered here (thus, for example, a procedure call with two meanings can be ambiguous even if one of them involves passing a constant as an OUT parameter). My point was that the rules in the Dynamic Semantics are not considered at all during this phase. -- Adam