comp.lang.ada
 help / color / mirror / Atom feed
* Ada Java question
@ 1997-02-26  0:00 Kendal Van Dyke
  1997-02-27  0:00 ` Tucker Taft
  1997-02-28  0:00 ` Ada Java question Tom Halliley
  0 siblings, 2 replies; 23+ messages in thread
From: Kendal Van Dyke @ 1997-02-26  0:00 UTC (permalink / raw)



I am trying to redefine the keyDown event so that I can do something
when an arrow key is pressed while an applet is running, but I seem to
be having a problem when I compile  - it's giving me errors saying that
"Direct name, event, is not visible"

Here is my code. What's wrong with it?

  function keyDown(obj : access tank_obj;

  		   e : event_ptr;

  		   key : Integer) return boolean is

  begin

    CASE key IS

      WHEN event.UP => return true;

      WHEN event.DOWN => return true;

      WHEN event.LEFT => return true;

      WHEN event.RIGHT => return true;

      WHEN Others => return true;

    end CASE;  

    return true;

  end keyDown;

Any help is of course much appreciated!
-- 
    *.........................................*
    .                |/                       .
    .                |\ENDAL                  .
    . WWW   => http://www.cs.fsu.edu/~vandyke .
    . EMail => vandyke@cs.fsu.edu             .
    . Pager => (904) 297-6658                 .
    .                                         .
    *.........................................*




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

* Re: Ada Java question
  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 ` Ada Java question Tom Halliley
  1 sibling, 1 reply; 23+ messages in thread
From: Tucker Taft @ 1997-02-27  0:00 UTC (permalink / raw)



Kendal Van Dyke (kendal@fn3.freenet.tlh.fl.us) wrote:

: I am trying to redefine the keyDown event so that I can do something
: when an arrow key is pressed while an applet is running, but I seem to
: be having a problem when I compile  - it's giving me errors saying that
: "Direct name, event, is not visible"

: Here is my code. What's wrong with it?

:   function keyDown(obj : access tank_obj;

:   		   e : event_ptr;

:   		   key : Integer) return boolean is

:   begin

:     CASE key IS

:       WHEN event.UP => return true;

You need to show us the "with" clauses for your code to know whether
"event" is visible or not.  Perhaps you need to write "java.awt.event.UP"
instead of just "event," or include a "use java.awt;" after your
with clause for "java.awt.event."

In general, if you have a compir problem, be sure to include an entire but
minimal test case, and include the error messages as produced by the
compiler.  Otherwise, your potential helpers will have to just guess
at the real problem.

: Any help is of course much appreciated!
:     .                |/                       .
:     .                |\ENDAL                  .
:     . WWW   => http://www.cs.fsu.edu/~vandyke .
:     . EMail => vandyke@cs.fsu.edu             .
:     . Pager => (904) 297-6658                 .

-Tucker Taft   stt@inmet.com   http://www.inmet.com/~stt/
Intermetrics, Inc.  Burlington, MA  USA




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

* Re: Ada Java question  => clarification
  1997-02-27  0:00 ` Tucker Taft
@ 1997-02-28  0:00   ` Kendal Van Dyke
  1997-02-28  0:00     ` Tucker Taft
  0 siblings, 1 reply; 23+ messages in thread
From: Kendal Van Dyke @ 1997-02-28  0:00 UTC (permalink / raw)



Ok, to provide more specific details as to my problem, here are the with
and use clauses that accompany the package that contains this function.
Again, when I try to compile it I get the error "Direct name, event, is
not visible".

----------------
with java.applet.applet; use java.applet.applet;

with java.lang.runnable; use java.lang.runnable;

with java.awt.event; use java.awt.event;

with java.lang.thread; use java.lang.thread;

with java.awt.component; use java.awt.component;

with java.awt.color; use java.awt.color;

with java.awt.graphics; use java.awt.graphics;

  function keyDown(obj : access tank_obj;

  		   e : event_ptr;

  		   key : Integer) return boolean is

  begin

    CASE key IS

      WHEN event.UP => return true;
      WHEN event.DOWN => return true;
      WHEN event.LEFT => return true;
      WHEN event.RIGHT => return true;
      WHEN Others => return true;
    end CASE;  

    return true;

  end keyDown;
------------------

Any ideas anyone?
-- 
    *.........................................*
    .                |/                       .
    .                |\ENDAL                  .
    . WWW   => http://www.cs.fsu.edu/~vandyke .
    . EMail => vandyke@cs.fsu.edu             .
    . Pager => (904) 297-6658                 .
    .                                         .
    *.........................................*




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

* Re: Ada Java question  => clarification
  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
  0 siblings, 1 reply; 23+ messages in thread
From: Tucker Taft @ 1997-02-28  0:00 UTC (permalink / raw)



Kendal Van Dyke (kendal@fn3.freenet.tlh.fl.us) wrote:

: Ok, to provide more specific details as to my problem, here are the with
: and use clauses that accompany the package that contains this function.
: Again, when I try to compile it I get the error "Direct name, event, is
: not visible".

It would be helpful to identify on which line each error occurs.

However, in this case, the problem is as I suspected.  The identifier
"event" is not directly visible.  The full name "java.awt.event" is
usable (because you "with" ed it), and the entities declared
inside java.awt.event are directly visible (because you "use"d it),
but the name "event" itself is *not* directly visible.  You can
do any of the following:
  1) use the full name "java.awt.event" instead of "event";
  2) drop the use of "event" in "event.UP" and say simply "UP";
  3) add a "use" clause for "java.awt" which will make the package
     names "event", "component", "color", and "graphics" directly visible.


: ----------------
: with java.applet.applet; use java.applet.applet;

: with java.lang.runnable; use java.lang.runnable;

: with java.awt.event; use java.awt.event;

: with java.lang.thread; use java.lang.thread;

: with java.awt.component; use java.awt.component;

: with java.awt.color; use java.awt.color;

: with java.awt.graphics; use java.awt.graphics;

:   function keyDown(obj : access tank_obj;

:   		   e : event_ptr;

:   		   key : Integer) return boolean is

:   begin

:     CASE key IS

:       WHEN event.UP => return true;
:       WHEN event.DOWN => return true;
:       WHEN event.LEFT => return true;
:       WHEN event.RIGHT => return true;
:       WHEN Others => return true;
:     end CASE;  

:     return true;

:   end keyDown;
: ------------------

: Any ideas anyone?
: -- 
:     *.........................................*
:     .                |/                       .
:     .                |\ENDAL                  .
:     . WWW   => http://www.cs.fsu.edu/~vandyke .
:     . EMail => vandyke@cs.fsu.edu             .
:     . Pager => (904) 297-6658                 .
:     .                                         .
:     *.........................................*

--
-Tucker Taft   stt@inmet.com   http://www.inmet.com/~stt/
Intermetrics, Inc.  Burlington, MA  USA




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

* Re: Ada Java question  => clarification
  1997-02-28  0:00     ` Tucker Taft
@ 1997-02-28  0:00       ` Brad Balfour
  1997-02-28  0:00         ` Kendal Van Dyke
                           ` (2 more replies)
  0 siblings, 3 replies; 23+ messages in thread
From: Brad Balfour @ 1997-02-28  0:00 UTC (permalink / raw)



In article <E6BGyu.Ip6.0.-s@inmet.camb.inmet.com>,
stt@houdini.camb.inmet.com (Tucker Taft) wrote:

>Kendal Van Dyke (kendal@fn3.freenet.tlh.fl.us) wrote:
>
>: Ok, to provide more specific details as to my problem, here are the with
>: and use clauses that accompany the package that contains this function.
>: Again, when I try to compile it I get the error "Direct name, event, is
>: not visible".
[snip]
>...You can
>do any of the following:
>  1) use the full name "java.awt.event" instead of "event";
>  2) drop the use of "event" in "event.UP" and say simply "UP";
>  3) add a "use" clause for "java.awt" which will make the package
>     names "event", "component", "color", and "graphics" directly visible.

However, once you follow #1, you will get the following error for each
case choice:

      WHEN java.awt.event.UP => return true;
keydown.ada: Error: line 30 col 27 LRM:3.8.1(8) & 5.4(5), The expression
in the discrete choice must be static

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.

Brad


>:     .                |/                       .
>:     .                |\ENDAL                  .
>:     . WWW   => http://www.cs.fsu.edu/~vandyke .
>:     . EMail => vandyke@cs.fsu.edu             .
>:     . Pager => (904) 297-6658                 .
>-Tucker Taft   stt@inmet.com   http://www.inmet.com/~stt/
>Intermetrics, Inc.  Burlington, MA  USA

-- 
Brad Balfour                            SIGAda WWW Server
CACI, Inc.                                http://www.acm.org/sigada/
(703) 277-6767                          and also try:
bbalfour@std.caci.com                     http://www.adahome.com/
3930 Pender Drive     Fairfax, VA 22030
   "...they even have rules for exceptions" -- Dewar and Schonberg




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

* Re: Ada Java question  => clarification
  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           ` Fergus Henderson
  1997-02-28  0:00         ` Ada Java question => oops!! Kendal Van Dyke
  1997-03-02  0:00         ` Ada Java question => clarification Robert Dewar
  2 siblings, 2 replies; 23+ messages in thread
From: Kendal Van Dyke @ 1997-02-28  0:00 UTC (permalink / raw)



Brad Balfour wrote:

> >do any of the following:
> >  1) use the full name "java.awt.event" instead of "event";
> >  2) drop the use of "event" in "event.UP" and say simply "UP";
> >  3) add a "use" clause for "java.awt" which will make the package
> >     names "event", "component", "color", and "graphics" directly visible.
> 
> However, once you follow #1, you will get the following error for each
> case choice:
> 
>       WHEN java.awt.event.UP => return true;
> keydown.ada: Error: line 30 col 27 LRM:3.8.1(8) & 5.4(5), The expression
> in the discrete choice must be static

Ok, after changing the case statement to an if statement, I STILL had to
use the full name (java.awt.event.[up, down, left, right, etc]) in order
for it to work right, even with the with and use clauses for
java.awt.event . Don't know if that's a big deal or not....just extra
typing for me at the least!

Anyways, it works now. Thanks to all for the help!
-- 
    *.........................................*
    .                |/                       .
    .                |\ENDAL                  .
    . WWW   => http://www.cs.fsu.edu/~vandyke .
    . EMail => vandyke@cs.fsu.edu             .
    . Pager => (904) 297-6658                 .
    .                                         .
    *.........................................*




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

* Re: Ada Java question  => oops!!
  1997-02-28  0:00       ` Brad Balfour
  1997-02-28  0:00         ` Kendal Van Dyke
@ 1997-02-28  0:00         ` Kendal Van Dyke
  1997-03-02  0:00         ` Ada Java question => clarification Robert Dewar
  2 siblings, 0 replies; 23+ messages in thread
From: Kendal Van Dyke @ 1997-02-28  0:00 UTC (permalink / raw)



> >...You can
> >do any of the following:
> >  1) use the full name "java.awt.event" instead of "event";
> >  2) drop the use of "event" in "event.UP" and say simply "UP";

OOPS! I didn't realize that earlier in my package spec I had defined a
new type (TYPE DIRECTION IS (up, down, left, right);). Because of the
new type I had defined, the compiler thought that when I referred to up,
down, left, or right that I was referring to something in that new type
I had defined, and NOT java.awt.event.up, down, left, or right.....Which
is why I had to specify the full java.awt.event name. I took the new
type I had defined out of the spec and bingo! I could access up, down,
left, and right without the full name.

So, my oversight....no compiler bugs or anything like that. Please
forgive me, I'm still learning! Thanks again for the help from everyone.
-- 
    *.........................................*
    .                |/                       .
    .                |\ENDAL                  .
    . WWW   => http://www.cs.fsu.edu/~vandyke .
    . EMail => vandyke@cs.fsu.edu             .
    . Pager => (904) 297-6658                 .
    .                                         .
    *.........................................*




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

* Re: Ada Java question
  1997-02-26  0:00 Ada Java question Kendal Van Dyke
  1997-02-27  0:00 ` Tucker Taft
@ 1997-02-28  0:00 ` Tom Halliley
  1 sibling, 0 replies; 23+ messages in thread
From: Tom Halliley @ 1997-02-28  0:00 UTC (permalink / raw)



Kendal Van Dyke wrote:
> 
> I am trying to redefine the keyDown event so that I can do something
> when an arrow key is pressed while an applet is running, but I seem to
> be having a problem when I compile  - it's giving me errors saying that
> "Direct name, event, is not visible"
> 
> Here is my code. What's wrong with it?
> 
>   function keyDown(obj : access tank_obj;
> 
>                    e : event_ptr;
> 

Do you mean "event" here, rather than "e"?

>                    key : Integer) return boolean is
> 
>   begin
> 
>     CASE key IS
> 
>       WHEN event.UP => return true;
> 
>       WHEN event.DOWN => return true;
> 
>       WHEN event.LEFT => return true;
> 
>       WHEN event.RIGHT => return true;
> 
>       WHEN Others => return true;
> 
>     end CASE;
> 
>     return true;
> 
>   end keyDown;
> 


TomH
 
-------------------------------------------------------------------
J. Thomas Halliley | Principal Software Engineer |  619.824.0348
  tomh@aonix.com   |            Aonix            | San Diego,  CA




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

* Re: Ada Java question  => clarification
  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-01  0:00           ` Fergus Henderson
  1 sibling, 1 reply; 23+ messages in thread
From: Norman H. Cohen @ 1997-02-28  0:00 UTC (permalink / raw)



Kendal Van Dyke wrote:

> Ok, after changing the case statement to an if statement, I STILL had to
> use the full name (java.awt.event.[up, down, left, right, etc]) in order
> for it to work right, even with the with and use clauses for
> java.awt.event . Don't know if that's a big deal or not....just extra
> typing for me at the least!

What you need is a with clause for java.awt.event and a use clause for
java.awt.  A use clause for java.awt.event allows you to abbreviate
java.awt.event.up as up, but not as event.up.  A use clause for java.awt
allows you to abbreviate java.awt.event as event, which is what you are
doing when you write event.up.

-- 
Norman H. Cohen
mailto:ncohen@watson.ibm.com
http://www.research.ibm.com/people/n/ncohen




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

* Re: Ada Java question => clarification
  1997-02-28  0:00           ` Norman H. Cohen
@ 1997-03-01  0:00             ` David Taylor
  1997-03-02  0:00               ` Robert Dewar
  0 siblings, 1 reply; 23+ messages in thread
From: David Taylor @ 1997-03-01  0:00 UTC (permalink / raw)



In article <33174B1A.5353@watson.ibm.com>, "Norman H. Cohen"
<ncohen@watson.ibm.com> wrote:

>Kendal Van Dyke wrote:
>
>> Ok, after changing the case statement to an if statement, I STILL had to
>> use the full name (java.awt.event.[up, down, left, right, etc]) in order
<snip>
>What you need is a with clause for java.awt.event and a use clause for
>java.awt.  A use clause for java.awt.event allows you to abbreviate
<snip>
>-- 
>Norman H. Cohen
>mailto:ncohen@watson.ibm.com
>http://www.research.ibm.com/people/n/ncohen

I would like to make a case here for avoiding the "use" except in those
special locations where it otherwise obscures the logic (e.g.: evaluating a
complicated math expression). Even there, the "use" can be restriced to the
local block. 

Speaking as one who has spent a lot of time modifying existing code, the
"use" can really confuse the issue.  Surely, more keystrokes cannot be that
big of a deal. 

Just my 2 cents worth.

dave taylor




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

* Re: Ada Java question => clarification
  1997-02-28  0:00         ` Kendal Van Dyke
  1997-02-28  0:00           ` Norman H. Cohen
@ 1997-03-01  0:00           ` Fergus Henderson
  1 sibling, 0 replies; 23+ messages in thread
From: Fergus Henderson @ 1997-03-01  0:00 UTC (permalink / raw)



Kendal Van Dyke <kendal@fn3.freenet.tlh.fl.us> writes:

>Brad Balfour wrote:
>
> [Tucker Taft wrote:]
>> >do any of the following:
>> >  1) use the full name "java.awt.event" instead of "event";
>> >  2) drop the use of "event" in "event.UP" and say simply "UP";
>> >  3) add a "use" clause for "java.awt" which will make the package
>> >     names "event", "component", "color", and "graphics" directly visible.
>> 
>> However, once you follow #1, you will get the following error for each
>> case choice:
>> 
>>       WHEN java.awt.event.UP => return true;
>> keydown.ada: Error: line 30 col 27 LRM:3.8.1(8) & 5.4(5), The expression
>> in the discrete choice must be static
>
>Ok, after changing the case statement to an if statement, I STILL had to
>use the full name (java.awt.event.[up, down, left, right, etc]) in order
>for it to work right, even with the with and use clauses for
>java.awt.event . Don't know if that's a big deal or not....just extra
>typing for me at the least!

That's because you adopted solution 1 above.
If you want less typing, use solution 2 or 3.

--
Fergus Henderson <fjh@cs.mu.oz.au>   |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>   |  of excellence is a lethal habit"
PGP: finger fjh@128.250.37.3         |     -- the last words of T. S. Garp.




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

* Re: Ada Java question => clarification
  1997-03-01  0:00             ` David Taylor
@ 1997-03-02  0:00               ` Robert Dewar
  1997-03-06  0:00                 ` David Taylor
  0 siblings, 1 reply; 23+ messages in thread
From: Robert Dewar @ 1997-03-02  0:00 UTC (permalink / raw)



Dave Taylor says

<<I would like to make a case here for avoiding the "use" except in those
special locations where it otherwise obscures the logic (e.g.: evaluating a
complicated math expression). Even there, the "use" can be restriced to the
local block.

Speaking as one who has spent a lot of time modifying existing code, the
"use" can really confuse the issue.  Surely, more keystrokes cannot be that
big of a deal.>>

OH no! Dave must be new to the list! Please, let's not have another
use vs no-use discussion. People feel differently on this issue, the
arguments are well understood, the last N threads on this subject have
added nothing new to our understanding. Dave (or others interested). I
suggest you seek out CLA archives if you want to study the arguments on
both sides of this issue.





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

* Re: Ada Java question => clarification
  1997-02-28  0:00       ` Brad Balfour
  1997-02-28  0:00         ` Kendal Van Dyke
  1997-02-28  0:00         ` Ada Java question => oops!! Kendal Van Dyke
@ 1997-03-02  0:00         ` Robert Dewar
  1997-03-03  0:00           ` Brad Balfour
  2 siblings, 1 reply; 23+ messages in thread
From: Robert Dewar @ 1997-03-02  0:00 UTC (permalink / raw)



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 :-)





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

* Re: Ada Java question => clarification
  1997-03-02  0:00         ` Ada Java question => clarification Robert Dewar
@ 1997-03-03  0:00           ` Brad Balfour
  1997-03-05  0:00             ` Robert Dewar
  0 siblings, 1 reply; 23+ messages in thread
From: Brad Balfour @ 1997-03-03  0:00 UTC (permalink / raw)



In article <dewar.857310278@merv>, dewar@merv.cs.nyu.edu (Robert Dewar) wrote:
>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.
>
>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.

Well, here's the logic I used when claiming that the two references to
3.8.1(8) & 5.4(5) in the error message (repeated just below) weren't as
much help as 4.9(24):
       WHEN java.awt.event.UP => return true;
   keydown.ada: Error: line 30 col 27 LRM:3.8.1(8) & 5.4(5), The expression
   in the discrete choice must be static

The error message text tells me that the "discrete choice must be static".
The discrete choice is java.awt.event.UP. [note: In the source code one
can see that java.awt.event.UP is declared as a constant integer. The big
question is what's wrong with using a java.awt.event.UP in this context]
When I check out 3.8.1(8), it tells me just what the message said: that
the choice must be static. No indication here why a constant integer isn't
static. Let's move on... I check out 5.4(5) and am told the same thing
again: "the expressions and discrete_ranges... shall be static." Again, no
indication on why a constant integer isn't static. These two RM95
references support the compilers assertiion that the expression choice
must be static. They are correct references, they just aren't useful.The
programmer put an non static value in the choice, so pointing the person
to an assertion that the value must be static doesn't tell you much;
especially if the value put in the choice *seems static*, i.e., its a
constant integer. By a basic understanding of the term static, a constant
integer looks like a static thing. It's only when you look at 4.9(24) that
you get a definition of what is or is not static and find out that the
constant integer which is imported is *not* static.

My comment isn't that the references are wrong or bad, just incomplete.
Adding in a reference to the definition of static in 4.9(24) would help an
error message that tells the programmer that the expression must be
static.

Robert also writes:
>Brad wrote:
>>So, unfortunately, you need to change the case statement into an if
>>statement.
>
>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 :-)

I only meant that it is unfortunate since the person already wrote a case
statement. Therefore, they have to spend 30 seconds in the editor to
change it to an if statement. That's all.

I had no further expectations. Just sympathy for the (quick) code change needed.

Brad

-- 
Brad Balfour                            SIGAda WWW Server
CACI, Inc.                                http://www.acm.org/sigada/
(703) 277-6767                          and also try:
bbalfour@std.caci.com                     http://www.adahome.com/
3930 Pender Drive     Fairfax, VA 22030
   "...they even have rules for exceptions" -- Dewar and Schonberg




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

* Re: Ada Java question => clarification
  1997-03-03  0:00           ` Brad Balfour
@ 1997-03-05  0:00             ` Robert Dewar
  1997-03-05  0:00               ` Brad Balfour
  0 siblings, 1 reply; 23+ messages in thread
From: Robert Dewar @ 1997-03-05  0:00 UTC (permalink / raw)



Brad said

<<,The discrete choice is java.awt.event.UP. [note: In the source code one
can see that java.awt.event.UP is declared as a constant integer. The big
question is what's wrong with using a java.awt.event.UP in this context]
When I check out 3.8.1(8), it tells me just what the message said: that
the choice must be static. No indication here why a constant integer isn't
static. Let's move on... I check out 5.4(5) and am told the same thing>>

you miss my point. For *you* the problem with the message is that you
knew this was a case choice, you knew that the choice had to be static,
what you didn't know was why the expression you wrote was non-static.

Sure the message is incomplete, to be complete, it would have to have the
whole reference manual there, or at least a transitive closure of all
parts of it that could be relevant (right down to the syntax of identifiers)

Imagine another user saying, "well of course I know the function call
is non-static, anyone knows that, but this is the first I knew that
case choices had to be static, where does it say that -- and sure enough
the RM reference given is reasonable in this case".

Or imagine another user who says, well of course I know that case choices
had to be static, but I thought choices only meant the case where you used
the | character and had multiple choices in a single case ...


Get the idea? There is no such thing as a wrong reference here, you can
write many more scenarios like the above.

There is a most likely misunderstanding, and I would tend to agree with
you that your misunderstanding was the most likely, but you cannot prove
that the RM reference is inappropriate or wrong by starting with the
assumption that obviously your misunderstanding is the same as any one
elses in this particular situation.





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

* Re: Ada Java question => clarification
  1997-03-05  0:00             ` Robert Dewar
@ 1997-03-05  0:00               ` Brad Balfour
  0 siblings, 0 replies; 23+ messages in thread
From: Brad Balfour @ 1997-03-05  0:00 UTC (permalink / raw)



In article <dewar.857568580@merv>, dewar@merv.cs.nyu.edu (Robert Dewar) wrote:
>There is a most likely misunderstanding, and I would tend to agree with
>you that your misunderstanding was the most likely, but you cannot prove
>that the RM reference is inappropriate or wrong by starting with the
>assumption that obviously your misunderstanding is the same as any one
>elses in this particular situation.

True. And I don't really think that the two references provided in the
error message are "inappropriate or wrong". I just think that they are
incomplete. You are 100% correct when you point out that to be complete
the message must include the transitive closure of the RM. I'm not really
advocating that position. I'd just like the RM references to include some
of the "likely" misunderstandings, such as the one I illustrated. But, as
you've pointed out, it's a judgement call as to which are likely
misunderstandings. Other people's may not be same as mine. As always,
"your milage may vary".

-- 
Brad Balfour                            SIGAda WWW Server
CACI, Inc.                                http://www.acm.org/sigada/
(703) 277-6767                          and also try:
bbalfour@std.caci.com                     http://www.adahome.com/
3930 Pender Drive     Fairfax, VA 22030
   "...they even have rules for exceptions" -- Dewar and Schonberg




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

* Re: Ada Java question => clarification
  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-09  0:00                   ` Robert Dewar
  0 siblings, 2 replies; 23+ messages in thread
From: David Taylor @ 1997-03-06  0:00 UTC (permalink / raw)



In article <dewar.857305007@merv>, dewar@merv.cs.nyu.edu (Robert Dewar)
wrote:

>Dave Taylor says
>
><<I would like to make a case here for avoiding the "use" 
and Robert Dewar says:
>OH no! Dave must be new to the list! Please, let's not have another
>use vs no-use discussion. 

and Dave Taylor responds that this sounds like the same kind of argument as
"do you kids go to neighborhood schools or do they get bussed across town." 
So, I will let the dust settle quickly and not bring it up again. Nor will I
enter into a discussion as to whether or not keywords should be upper- or
lower- case. 

Dave Taylor





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

* tagged type auto-"Use", was Re: Ada Java question => clarification
  1997-03-06  0:00                 ` David Taylor
@ 1997-03-08  0:00                   ` Tom Moran
  1997-03-10  0:00                     ` Dennis Reimer
  1997-03-09  0:00                   ` Robert Dewar
  1 sibling, 1 reply; 23+ messages in thread
From: Tom Moran @ 1997-03-08  0:00 UTC (permalink / raw)



Given:
with root;
package body x is
  type y is new root.some_tagged_type with ...

A reference to root.some_inherited_procedure refers to just that, and
takes root.xxx as a parameter.  In order to take something of type y as
a parameter one must say
  some_inherited_procedure(some_y_thing...
which has many of the disadvantages (can't see where something came
from) of a 'use' clause.  OTOH, if some programming guidelines said "no
USE clauses", this would be an easy way around the rule.
  As someone who rarely uses use, I find this troubling.  Comments?




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

* Re: Ada Java question => clarification
  1997-03-09  0:00                     ` Larry Kilgallen
@ 1997-03-09  0:00                       ` Robert Dewar
  1997-03-15  0:00                         ` Matthew Heaney
  0 siblings, 1 reply; 23+ messages in thread
From: Robert Dewar @ 1997-03-09  0:00 UTC (permalink / raw)



Larry says

<<Please start a new topic so we can discuss which topics to put on the list>>

yes, yes, I know, the first item of business is to decide whether this topic
itself belongs on its own list. Pretty soon we will have a Russell paradox
somewhere in sight :-)





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

* Re: Ada Java question => clarification
  1997-03-06  0:00                 ` David Taylor
  1997-03-08  0:00                   ` tagged type auto-"Use", was " Tom Moran
@ 1997-03-09  0:00                   ` Robert Dewar
  1997-03-09  0:00                     ` Larry Kilgallen
  1 sibling, 1 reply; 23+ messages in thread
From: Robert Dewar @ 1997-03-09  0:00 UTC (permalink / raw)



Dave says

<<and Dave Taylor responds that this sounds like the same kind of argument as
"do you kids go to neighborhood schools or do they get bussed across town."
So, I will let the dust settle quickly and not bring it up again. Nor will I
enter into a discussion as to whether or not keywords should be upper- or
lower- case.>>


:-)

Maybe there should be a list of forbidden topics on CLA :-) :-)





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

* Re: Ada Java question => clarification
  1997-03-09  0:00                   ` Robert Dewar
@ 1997-03-09  0:00                     ` Larry Kilgallen
  1997-03-09  0:00                       ` Robert Dewar
  0 siblings, 1 reply; 23+ messages in thread
From: Larry Kilgallen @ 1997-03-09  0:00 UTC (permalink / raw)



In article <dewar.857912121@merv>, dewar@merv.cs.nyu.edu (Robert Dewar) writes:
> Dave says
> 
> <<and Dave Taylor responds that this sounds like the same kind of argument as
> "do you kids go to neighborhood schools or do they get bussed across town."
> So, I will let the dust settle quickly and not bring it up again. Nor will I
> enter into a discussion as to whether or not keywords should be upper- or
> lower- case.>>
> 
> 
> :-)
> 
> Maybe there should be a list of forbidden topics on CLA :-) :-)

Please start a new topic so we can discuss which topics to put on the list.

 :-) :-) :-)




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

* Re: tagged type auto-"Use", was Re: Ada Java question => clarification
  1997-03-08  0:00                   ` tagged type auto-"Use", was " Tom Moran
@ 1997-03-10  0:00                     ` Dennis Reimer
  0 siblings, 0 replies; 23+ messages in thread
From: Dennis Reimer @ 1997-03-10  0:00 UTC (permalink / raw)



Tom Moran wrote:
> 
> Given:
> with root;
> package body x is
>   type y is new root.some_tagged_type with ...
> 
> A reference to root.some_inherited_procedure refers to just that, and
> takes root.xxx as a parameter.  In order to take something of type y as
> a parameter one must say
>   some_inherited_procedure(some_y_thing...
> which has many of the disadvantages (can't see where something came
> from) of a 'use' clause.  OTOH, if some programming guidelines said "no
> USE clauses", this would be an easy way around the rule.
>   As someone who rarely uses use, I find this troubling.  Comments?

It doesn't have to be a tagged type either.  Any type that is derived
will inherit the primitive operations of the parent type.  This feature
also existed in Ada 83 and was referred to as derived subprograms.
I have seen it used several times in Ada 83 programs to get around the
"no USE clauses" rule.  It also avoids having to rename some of the
commonly used basic operations such as "=" when 'use' clauses are not
permitted.




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

* Re: Ada Java question => clarification
  1997-03-09  0:00                       ` Robert Dewar
@ 1997-03-15  0:00                         ` Matthew Heaney
  0 siblings, 0 replies; 23+ messages in thread
From: Matthew Heaney @ 1997-03-15  0:00 UTC (permalink / raw)



In article <dewar.857943439@merv>, dewar@merv.cs.nyu.edu (Robert Dewar) wrote:

>Larry says
>
><<Please start a new topic so we can discuss which topics to put on the list>>
>
>yes, yes, I know, the first item of business is to decide whether this topic
>itself belongs on its own list. Pretty soon we will have a Russell paradox
>somewhere in sight :-)

But doesn't Ada have strong typing? :o)  Won't that solve the paradox?

--------------------------------------------------------------------
Matthew Heaney
Software Development Consultant
<mailto:matthew_heaney@acm.org>
(818) 985-1271




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

end of thread, other threads:[~1997-03-15  0:00 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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         ` Ada Java question => clarification Robert Dewar
1997-03-03  0:00           ` 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

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