comp.lang.ada
 help / color / mirror / Atom feed
From: adam@irvine.com (Adam Beneschan)
Subject: Re: Language lawyer question: Equality on 'Access attributes
Date: 8 Jan 2004 17:23:47 -0800
Date: 2004-01-08T17:23:47-08:00	[thread overview]
Message-ID: <b4682ab7.0401081723.67c93545@posting.google.com> (raw)
In-Reply-To: wcc1xqa1fmj.fsf@shell01.TheWorld.com

Robert A Duff <bobduff@shell01.TheWorld.com> wrote in message news:<wcc1xqa1fmj.fsf@shell01.TheWorld.com>...

> >...  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



  parent reply	other threads:[~2004-01-09  1:23 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-01-08  2:05 Language lawyer question: Equality on 'Access attributes Adam Beneschan
2004-01-08  7:47 ` Robert I. Eachus
2004-01-08 11:07   ` Dmitry A. Kazakov
2004-01-08 17:18   ` Adam Beneschan
2004-01-08 18:04     ` Robert A Duff
2004-01-08 18:31       ` Ze Administrator
2004-01-08 21:04         ` Robert A Duff
2004-01-09  4:02           ` Ze Administrator
2004-01-09 23:02             ` Robert A Duff
2004-01-10  2:56               ` Ze Administrator
2004-01-09  4:06           ` Ze Administrator
2004-01-09 23:05             ` Robert A Duff
2004-01-10  3:03               ` Ze Administrator
2004-01-10 13:47                 ` Marin David Condic
2004-01-10  7:19               ` Robert I. Eachus
2004-01-10 19:09                 ` Robert A Duff
2004-01-11 14:27                   ` Robert I. Eachus
2004-01-11 21:42                     ` Ze Administrator
2004-01-12  5:16                       ` Robert I. Eachus
2004-01-09  1:28         ` Adam Beneschan
2004-01-09  4:10           ` Ze Administrator
2004-01-09 11:27             ` Dmitry A. Kazakov
2004-01-09 23:09               ` Robert A Duff
2004-01-10 11:56                 ` Dmitry A. Kazakov
2004-01-10 17:08                   ` Robert I. Eachus
2004-01-10 18:40                   ` Robert A Duff
2004-01-09 23:08             ` Robert A Duff
2004-01-10  7:39               ` Robert I. Eachus
2004-01-08 20:36       ` tmoran
2004-01-08 21:06         ` Robert A Duff
2004-01-09  0:27       ` Randy Brukardt
2004-01-09  1:23       ` Adam Beneschan [this message]
2004-01-09  1:38         ` Robert A Duff
2004-01-09  6:16       ` Robert I. Eachus
2004-01-09 23:27         ` Randy Brukardt
2004-01-10 16:37           ` Robert I. Eachus
     [not found] ` <hmfvc1-f73.ln1@beastie.ix.netcom.com>
     [not found]   ` <l7v1d1-n33.ln1@beastie.ix.netcom.com>
2004-01-09 23:19     ` Robert A Duff
2004-01-09 23:21     ` Randy Brukardt
  -- strict thread matches above, loose matches on Subject: below --
2004-01-09  5:48 christoph.grein
2004-01-09  6:03 christoph.grein
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox