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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,d402e2c741db0d0 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2004-01-08 17:23:47 PST Path: archiver1.google.com!postnews1.google.com!not-for-mail From: adam@irvine.com (Adam Beneschan) Newsgroups: comp.lang.ada Subject: Re: Language lawyer question: Equality on 'Access attributes Date: 8 Jan 2004 17:23:47 -0800 Organization: http://groups.google.com Message-ID: References: <4LKdnRRNyv6AlmCiRVn-ig@comcast.com> NNTP-Posting-Host: 66.126.103.122 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1073611427 13810 127.0.0.1 (9 Jan 2004 01:23:47 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Fri, 9 Jan 2004 01:23:47 +0000 (UTC) Xref: archiver1.google.com comp.lang.ada:4233 Date: 2004-01-08T17:23:47-08:00 List-Id: Robert A Duff wrote in message news:... > >... This makes X'Access rather unique in this > > regard. I believe that for any other construct that returns a value, > > one can determine what the type of the construct is (once it has been > > determined what declarations all the usage names pertain to) without > > knowing anything about the context in which the construct occurs. > > Well, there are many cases where *context* is required to resolve > overloading. For example: > > type Color is (Red); > type Light is (Red, Amber, Green); > > procedure P(X: Light); > > P(Red); -- Same as P(Light'(Red)); That's why I included the parenthesized phrase, "once it has been determined what declarations the usage names pertain to". Once you've determined that the name "Red" pertains to the second declaration of Red, and not the first one, you then know what the type of "Red" is. (Of course, you need the context to determine which declaration is the correct one.) This isn't the case for X'Access: even if you know what declaration X refers to, you still don't know waht type X'Access is. However, I was wrong when I thought that 'Access was unique here. There are other cases where the type of a construct cannot be determined without context: namely, "null", character literals, and string literals. > You said above, "once it has been determined what declarations all the > usage names pertain to". But that's sort of backward, since you can't > determine that without feeding information down from context (namely, > the type of the parameter X of procedure P). I have to admit that while I think my assertion is true, it's pretty abstract. It probably requires one to think backwards from how a practical programmer, or a compiler, would think when trying to determine the meaning of an Ada statement like that. -- Adam