is this GNAT error message confusing or am I confused or both?
Robert Dewar
dewar@adacore.com
Fri Jan 7 03:09:00 GMT 2005
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.
More information about the Gcc
mailing list