public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* is this GNAT error message confusing or am I confused or both?
@ 2005-01-07  2:51 Georg Bauhaus
  2005-01-07  3:09 ` Robert Dewar
  0 siblings, 1 reply; 9+ messages in thread
From: Georg Bauhaus @ 2005-01-07  2:51 UTC (permalink / raw)
  To: gcc

The following error message has four occurences in
the GNAT sources. It has puzzled me several times.
I think it is really hard to understand because of
its "referential structure",
This is an example message printed by GNAT:

zx.adb:10:07: invalid prefix in selected component "X"

Maybe I'm just not familiar enough with the compiler writers'
point of view (or with Enlish language). A first question is,
what does "in" refer to? My current interpretation of the
message is that X is a prefix, then there is a thing termed
"component" and X is used as a prefix to the thing.
That is
   X     .Y
   prefix.component
(Have you thought otherwise? :-)
Is that really a "prefix in", not a "prefix to"?

When I first saw this message I was mislead, I think.
I was wondering where there was a prefix in component "X",
i.e., (in (component X)), not ((in component) X) or
(in component): and the invalid prefix is: "X".

I was asking myself, is there a prefix of the
name "X", not of some "Z.X", that denotes a component?
And what is invalid about it (the X, not the Z)?

This is the example from which the above message is produced.

procedure zx is

    package Z is
       Y: Natural;
    end Z;

    subtype X is Natural;

begin
    if X.Y /= 0 then
       null;
    end if;
end zx;

For me,
  x in attr "B"
is parenthesized as
  x in (attr "B")
which is not the way to read the above error message,
because "selected component" is not an attribute of "X",
I think. Is this right? Should the message text be changed
then?

Consider the message,

   invalid bucket in selected water "HasHoles"   ;-)

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: is this GNAT error message confusing or am I confused or both?
  2005-01-07  2:51 is this GNAT error message confusing or am I confused or both? Georg Bauhaus
@ 2005-01-07  3:09 ` Robert Dewar
  2005-01-07 13:43   ` Georg Bauhaus
  0 siblings, 1 reply; 9+ messages in thread
From: Robert Dewar @ 2005-01-07  3:09 UTC (permalink / raw)
  To: Georg Bauhaus; +Cc: gcc

Georg Bauhaus wrote:
> The following error message has four occurences in
> the GNAT sources. It has puzzled me several times.
> I think it is really hard to understand because of
> its "referential structure",
> This is an example message printed by GNAT:
> 
> zx.adb:10:07: invalid prefix in selected component "X"
> 
> Maybe I'm just not familiar enough with the compiler writers'
> point of view (or with Enlish language). A first question is,
> what does "in" refer to? My current interpretation of the
> message is that X is a prefix, then there is a thing termed
> "component" and X is used as a prefix to the thing.
> That is
>   X     .Y
>   prefix.component
> (Have you thought otherwise? :-)
> Is that really a "prefix in", not a "prefix to"?

Yes, prefix is a formal technical syntactic term as is
selected component, so the term "in" here means that
the prefix is a syntactic component of the selected
component (you can't just read it as the english
word prefix). So it is not a matter of a compiler
writers point of view, it is an issue of the vi.ew
of an Ada programmer familiar with the technical
terms of the language.

Here for reference is the grammar rule from the RM:

2   selected_component ::= prefix . selector_name

> Should the message text be changed
> then?
> 
> Consider the message,
> 
>   invalid bucket in selected water "HasHoles"   ;-)

Yes, but this sentence is normal english, I don't think the message
should be changed here, since it seems very clear and precise, and
the syntactic terms prefix and selected component are not really
obscure, but if you have an alternative suggestion, by all means
make it.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: is this GNAT error message confusing or am I confused or both?
  2005-01-07  3:09 ` Robert Dewar
@ 2005-01-07 13:43   ` Georg Bauhaus
  2005-01-07 14:34     ` Robert Dewar
  0 siblings, 1 reply; 9+ messages in thread
From: Georg Bauhaus @ 2005-01-07 13:43 UTC (permalink / raw)
  To: Robert Dewar; +Cc: gcc

Robert Dewar wrote:
>> zx.adb:10:07: invalid prefix in selected component "X"

> 2   selected_component ::= prefix . selector_name

Ah. The hint to the RM has made this a lot more clear,
thanks.

Still I speculate that there are a few GCC users like me
who have not managed to known all syntactic RM terms
by heart yet, so they can become victims of the
"sounds like" effect that Richard Kenner describes.

(Sounds like I should be perusing the RM, o.K.)

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: is this GNAT error message confusing or am I confused or both?
  2005-01-07 13:43   ` Georg Bauhaus
@ 2005-01-07 14:34     ` Robert Dewar
  0 siblings, 0 replies; 9+ messages in thread
From: Robert Dewar @ 2005-01-07 14:34 UTC (permalink / raw)
  To: Georg Bauhaus; +Cc: gcc

Georg Bauhaus wrote:

> Still I speculate that there are a few GCC users like me
> who have not managed to known all syntactic RM terms
> by heart yet, so they can become victims of the
> "sounds like" effect that Richard Kenner describes.
> 
> (Sounds like I should be perusing the RM, o.K.)

Well I thought Richard's suggestion of rewording was
a good one, and have filed it away to be done!

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: is this GNAT error message confusing or am I confused or both?
  2005-01-07 14:38     ` Robert Dewar
@ 2005-01-07 15:38       ` Georg Bauhaus
  0 siblings, 0 replies; 9+ messages in thread
From: Georg Bauhaus @ 2005-01-07 15:38 UTC (permalink / raw)
  To: Robert Dewar; +Cc: Richard Kenner, gcc

Robert Dewar wrote:
 
>>> Richard Kenner wrote:
> 
> 
>>>> I'd reword it as
>>>>     selected component has invalid prefix "X"
 
> I prefer Richard's first selection, 

Me too. :-)

Thanks!

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: is this GNAT error message confusing or am I confused or both?
  2005-01-07 13:47   ` Georg Bauhaus
@ 2005-01-07 14:38     ` Robert Dewar
  2005-01-07 15:38       ` Georg Bauhaus
  0 siblings, 1 reply; 9+ messages in thread
From: Robert Dewar @ 2005-01-07 14:38 UTC (permalink / raw)
  To: Georg Bauhaus; +Cc: Richard Kenner, gcc

Georg Bauhaus wrote:

>> Richard Kenner wrote:

>>> I'd reword it as
>>>     selected component has invalid prefix "X"

> I for one find these messages easier to follow.
> 
> Maybe less clear but in line with the other "invalids"
> 
>    invalid prefix of a selected component: "X"
> 
> Or, if possible
> 
>    invalid prefix to selector: "X"

I prefer Richard's first selection, to me it reads more
naturally, and the use of colon this way is out of style.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: is this GNAT error message confusing or am I confused or both?
  2005-01-07  5:08 ` Robert Dewar
@ 2005-01-07 13:47   ` Georg Bauhaus
  2005-01-07 14:38     ` Robert Dewar
  0 siblings, 1 reply; 9+ messages in thread
From: Georg Bauhaus @ 2005-01-07 13:47 UTC (permalink / raw)
  To: Robert Dewar; +Cc: Richard Kenner, gcc

Robert Dewar wrote:
> Richard Kenner wrote:

>> I'd reword it as
>>     selected component has invalid prefix "X"
>>
>> or
>>     "X" is an invalid prefix of a selected component
> 
> 
> that sounds like a reasonable suggestion. [...] it indeed may
> make things clearer

I for one find these messages easier to follow.

Maybe less clear but in line with the other "invalids"

    invalid prefix of a selected component: "X"

Or, if possible

    invalid prefix to selector: "X"

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: is this GNAT error message confusing or am I confused or both?
  2005-01-07  5:04 Richard Kenner
@ 2005-01-07  5:08 ` Robert Dewar
  2005-01-07 13:47   ` Georg Bauhaus
  0 siblings, 1 reply; 9+ messages in thread
From: Robert Dewar @ 2005-01-07  5:08 UTC (permalink / raw)
  To: Richard Kenner; +Cc: gcc

Richard Kenner wrote:
>     > This is an example message printed by GNAT:
>     > 
>     > zx.adb:10:07: invalid prefix in selected component "X"
> 
> I know what the terms mean, but my problem with this wording is that
> it makes it sound like "X" is the selected component and it somehow
> has an invalid prefix.
> 
> I'd reword it as
> 	selected component has invalid prefix "X"
> 
> or
> 	"X" is an invalid prefix of a selected component

that sounds like a reasonable suggestion. It's not a trivial
change (because of ACATS base line changes, and changes to
reference outputs in our test suite), but it indeed may
make things clearer

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: is this GNAT error message confusing or am I confused or both?
@ 2005-01-07  5:04 Richard Kenner
  2005-01-07  5:08 ` Robert Dewar
  0 siblings, 1 reply; 9+ messages in thread
From: Richard Kenner @ 2005-01-07  5:04 UTC (permalink / raw)
  To: dewar; +Cc: gcc

    > This is an example message printed by GNAT:
    > 
    > zx.adb:10:07: invalid prefix in selected component "X"

I know what the terms mean, but my problem with this wording is that
it makes it sound like "X" is the selected component and it somehow
has an invalid prefix.

I'd reword it as
	selected component has invalid prefix "X"

or
	"X" is an invalid prefix of a selected component

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2005-01-07 15:07 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-01-07  2:51 is this GNAT error message confusing or am I confused or both? Georg Bauhaus
2005-01-07  3:09 ` Robert Dewar
2005-01-07 13:43   ` Georg Bauhaus
2005-01-07 14:34     ` Robert Dewar
2005-01-07  5:04 Richard Kenner
2005-01-07  5:08 ` Robert Dewar
2005-01-07 13:47   ` Georg Bauhaus
2005-01-07 14:38     ` Robert Dewar
2005-01-07 15:38       ` Georg Bauhaus

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).