This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: is this GNAT error message confusing or am I confused or both?


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.



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]