comp.lang.ada
 help / color / mirror / Atom feed
From: dewar@merv.cs.nyu.edu (Robert Dewar)
Subject: Re: Ada Java question => clarification
Date: 1997/03/02
Date: 1997-03-02T00:00:00+00:00	[thread overview]
Message-ID: <dewar.857310278@merv> (raw)
In-Reply-To: bbalfour-2802971019510001@stmac0088.std.caci.com


Brad said

<<Despite the two RM95 references quoted above, the real reason is found in
4.9(24) which let's us know that a static constant must be a full constant
declaration or a renaming. java.awt.event.UP is a constant integer whose
value is supplied via a pragma Import. This means that it is constant, but
*not* a static constant.

So, unfortunately, you need to change the case statement into an if statement.>>

Two comments. First, it is always hard to guess why someone may not understand
something. Whether Brad's *real* reference is any more correct than the
RM references given depends on what you do and do not understand. If your
problem was that you did not realize that case statements required static
constants, then the original reference was fine. if you knew that, but
did not know what a static constant is, then some other RM reference is
right, if you know what a static constant is, but had forgotten that a
pragma Import does not make a constant static, then some other reference
is right, if you want to know WHY a pragma Import does not make a constant
static ("Hey, look at my Java code, it is obviously a static constant there"),
then some other RM reference is appropriate. That's the trouble with giving
an RM reference. You will never know which is the right one, and if you give
a wrong one, you waste the programmer's time on a wild goose chase.

Second, I don't see what is so unfortunate about this, it seems, if you think
about it, a natural restriction. I guess you could say it is unfortunate that
we do not have a kind of combined Ada-Java standard, with combined semantics,
and a combined compiler, but that would be asking a lot :-)

Generally, you cannot expect an Ada compiler to understand anything about
a foreign language unit that would require looking inside the unit and
understanding it in foreign language terms. Yes one can imagine an
Ada-to-Java compiler that would have this capability, but it is certainly
not something you are likely to encounter. Such a compiler could have given
a more informative message, something like:

    "static constant required in case statement"
    "constant "xxx" is static in Java, but not considered static on the Ada side"

or somesuch. I am not sure that any specific RM refernce is particularly
helpful here. There is no specific statement in the RM that a constant
completed by pragma Import is not-constant, it is the absence of a statement
to the contrary that is significant, and it is hard to give negative
references to the RM :-)





  parent reply	other threads:[~1997-03-02  0:00 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-02-26  0:00 Ada Java question Kendal Van Dyke
1997-02-27  0:00 ` Tucker Taft
1997-02-28  0:00   ` Ada Java question => clarification Kendal Van Dyke
1997-02-28  0:00     ` Tucker Taft
1997-02-28  0:00       ` Brad Balfour
1997-02-28  0:00         ` Kendal Van Dyke
1997-02-28  0:00           ` Norman H. Cohen
1997-03-01  0:00             ` David Taylor
1997-03-02  0:00               ` Robert Dewar
1997-03-06  0:00                 ` David Taylor
1997-03-08  0:00                   ` tagged type auto-"Use", was " Tom Moran
1997-03-10  0:00                     ` Dennis Reimer
1997-03-09  0:00                   ` Robert Dewar
1997-03-09  0:00                     ` Larry Kilgallen
1997-03-09  0:00                       ` Robert Dewar
1997-03-15  0:00                         ` Matthew Heaney
1997-03-01  0:00           ` Fergus Henderson
1997-02-28  0:00         ` Ada Java question => oops!! Kendal Van Dyke
1997-03-02  0:00         ` Robert Dewar [this message]
1997-03-03  0:00           ` Ada Java question => clarification Brad Balfour
1997-03-05  0:00             ` Robert Dewar
1997-03-05  0:00               ` Brad Balfour
1997-02-28  0:00 ` Ada Java question Tom Halliley
replies disabled

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