comp.lang.ada
 help / color / mirror / Atom feed
From: "Yannick Duchêne Hibou57" <yannick_duchene@yahoo.fr>
Subject: Re: prefix of dereference must be a name?
Date: Thu, 30 Jul 2009 10:36:41 -0700 (PDT)
Date: 2009-07-30T10:36:41-07:00	[thread overview]
Message-ID: <3fe4b8a8-daf9-4161-84e2-ff230a2e7afd@s15g2000yqs.googlegroups.com> (raw)
In-Reply-To: u4osuzlxw.fsf@stephe-leake.org

On 30 juil, 09:09, Stephen Leake <stephen_le...@stephe-leake.org>
wrote:
> [...]
> A.all := (C + B).all;
>
> [...]
> So then I tried:
> [...]
> A.all := -(C + B).all;
>
> and got the same error. Finally I tried:
>
> [...]
> A.all := Copy (C + B).all;
>
> And the compiler was happy.
>
> What's the rationale for this?
>
> [...]
> Similarly for ().all; when could that be a problem?
>
> --
> -- Stephe

Hi Stephe,

The reason behind this is in the language reference.

Let's go step by step.

First of all ARM 4.1.3 says:
(2) selected_component ::= prefix . selector_name
(3) selector_name ::= identifier | character_literal | operator_symbol

No special point with “ selector_name ” and any way, you did not get
into trouble with it.

Next, is the “ prefix ” part which is of big interest to you.

About it, ARM 4.1 says:
(2) name ::=
     direct_name | explicit_dereference
   | indexed_component | slice
   | selected_component | attribute_reference
   | type_conversion | function_call
   | character_literal


You may open you ARM reference or you may browse it at
http://www.adaic.com/standards/05rm/html/RM-TTL.html is you haven't
got one off-line on computer and then go to ARM 4.1 and follow each
links to know in detail about what the “ name ” part can be.

But you can see in the latter excerpt, that “ function_call ” appears,
but not “ expression ”.

Now about the rationale behind (previously given, was the direct
reason), I do not know, but I guess this may be to avoid any kind of
invisible temporaly variable (the result of a function is mostly an
initializer, not a returned variable).

If I find more about the rational, I will tell you, or perhaps some
one else will tell before ;)

Have a nice time

Yannick



  reply	other threads:[~2009-07-30 17:36 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-30  7:09 prefix of dereference must be a name? Stephen Leake
2009-07-30 17:36 ` Yannick Duchêne Hibou57 [this message]
2009-07-31 12:04   ` Stephen Leake
2009-07-31 12:23     ` Dmitry A. Kazakov
2009-07-31 21:49     ` Robert A Duff
2009-07-30 19:35 ` John B. Matthews
2009-08-03 14:44   ` Adam Beneschan
2009-08-03 17:46     ` John B. Matthews
2009-08-04  1:45 ` Adam Beneschan
2009-08-04  3:37   ` Yannick Duchêne Hibou57
replies disabled

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