From: sb463ba@d250-hrz.uni-duisburg.de (Georg Bauhaus)
Subject: Re: Elaborate compile-time error messages (was: GNAT Stream Read ...)
Date: 1999/01/11
Date: 1999-01-11T00:00:00+00:00 [thread overview]
Message-ID: <77cprt$d90$1@news-hrz.uni-duisburg.de> (raw)
In-Reply-To: 369366F1.67C06BF0@pwfl.com
Marin David Condic (condicma@bogon.pwfl.com) wrote:
: Larry Kilgallen wrote:
: > Is there some set of programmers who get
: > really mad at having the compiler be smarter
: > than they are about the nature of a problem.
(Two questions below.)
Given two source files, both plain wrong (a.k.a. nonsense),
admittedly, and differing only in the spelling of one
character, namely the P in these two lines:
< N : Integer := Private; -- capital "P" (yes, wrong anyway)
> N : Integer := private; -- small "p" (yes, wrong anyway)
----------------
package Emsg is -- not: emsg! (small "e")
N : Integer := Private; -- capital "P" (yes, wrong anyway)
end Emsg;
----------------
gnatf -v -ds emsg.ads
GNATF 3.09 (970121) Copyright 1991-1996 Free Software Foundation, Inc.
Checking: emsg.ads (source file time stamp: 1998-12-29 02:42:43)
Source recreated from tree for Emsg (spec)
------------------------------------------
package emsg is
n : integer := private;
end emsg;
2. N : Integer := Private; -- "P" (yes, wrong anyway)
|
>>> reserved word "private" cannot be used as identifier
3 lines: 1 error
Compilation exited abnormally with code 1 at Tue Dec 29 03:42:43
To me, this error message is quite satisfactory. Then
----------------
package Emsg is -- not: emsg! (small "e")
N : Integer := private; -- small "p" (yes, wrong anyway)
end Emsg;
----------------
gnatf -v -ds emsg.ads
GNATF 3.09 (970121) Copyright 1991-1996 Free Software Foundation, Inc.
Checking: emsg.ads (source file time stamp: 1998-12-29 02:30:36)
Source recreated from tree for Emsg (spec)
------------------------------------------
package emsg is
n : integer := <error>;
end emsg;
2. N : Integer := private; -- "P" (yes, wrong anyway)
|
>>> missing operand
3 lines: 1 error
Compilation exited abnormally with code 1 at Tue Dec 29 03:30:38
So, this time I understand that ":=" is missing an operand.
(right?) I explained to myself that these two very different
error messages might be the result of GNAT checking style.
Is this true?
QUESTION 1:
Why does GNAT behave so very differently when things
are spelled differently? (Try compiling with "emsg"
replacing "Emsg" in the above examples.)
I came across this when brooding over an error message that
informed me of a missing operand and an "is" that should be
":=", which felt right (
N : Integer is private;
-- operand missing between "Integer" and "is",
-- then "is" should be ":=".
Is "is" an operator? GNAT 1.83 just wants a ";" there.).
But, not knowing how a compiler works internally and the
formal aspects of languages in general, I was wondering where
the operator was. "is"? So, here is my second question:
QUESTION 2:
Is there a chance that someday GNAT will tell me *which*
operator is missing what? (Or have I overlooked something?)
More generally: Is there a way to have GNAT shout *why* it
was expecting something?
(Let me note (1) that it's still a pleasure working with GNAT
while thinking of C/Perl and what the compilers say when you
forgot to place a ';' somewhere. And (2), I see that I
had better know how compilation is done in order to understand
error messages, much like if I'm driving a car through the
desert and know something about motors and brakes.
But then, some people just want to ride somewhere...)
with best regards,
Georg
next prev parent reply other threads:[~1999-01-11 0:00 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-01-05 0:00 GNAT Stream Read processing problem Bruce Detter
1999-01-05 0:00 ` Tom Moran
1999-01-05 0:00 ` Bruce Detter
1999-01-06 0:00 ` dewar
1999-01-06 0:00 ` Bruce Detter
1999-01-06 0:00 ` Elaborate compile-time error messages (was: GNAT Stream Read ...) Larry Kilgallen
1999-01-06 0:00 ` bourguet
1999-01-06 0:00 ` Marin David Condic
1999-01-11 0:00 ` Georg Bauhaus [this message]
1999-01-13 0:00 ` Simon Wright
1999-01-07 0:00 ` dewar
1999-01-07 0:00 ` Larry Kilgallen
1999-01-10 0:00 ` robert_dewar
1999-01-06 0:00 ` GNAT Stream Read processing problem Matthew Heaney
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox