comp.lang.ada
 help / color / mirror / Atom feed
From: "Kevin J. Weise" <kweise@c3i-ccmail.sed.redstone.army.mil>
Subject: Re: "use" clauses and Ada 95 OOP
Date: 1996/07/23
Date: 1996-07-23T00:00:00+00:00	[thread overview]
Message-ID: <4t2qib$f0o@michp1.redstone.army.mil> (raw)
In-Reply-To: Duzwxx.8E1.0.-s@inmet.camb.inmet.com


mg@asp.camb.inmet.com (Mitch Gart) wrote:
>
>But my point is that a naive Ada 95 reader might think that the call
>  
>    pkg1.func(x) 
>
>calls the code that is in the body of pkg1.  The syntax in fact 
>implies that strongly.  To know it's not true a reader has to look
>at the spec of pkg1 and figure out that x is a tagged type and
>func is a primitive operation on a variable or anonymous access 
>type, in order to know that the call is dispatching.
>

(My note:  original example involved Java syntax and semantics, which 
I don't know, but which I am assuming will be sufficiently similar to 
C++)

What about the point that a naive C++ reader might think that the 
call

     x.func

calls the code that is in the class of x (say, class X).  The syntax, 
in fact, implies that strongly.  To know its not true, the reader has 
to look at the public part of class X and figure out that it inherits 
class Y (and maybe even more classes), then look at the public part 
of class Y (& other inherited classes), and then the classes that 
those classes inherit, and so on, until it finds the class in which 
the function is introduced.

Does not Java class syntax & semantics behave in the same (or 
similar) fashion?

> In Ada 95 OOP we can have the situation where a call
>
>     pkg1.func(x)
>
> dispatches at runtime to
>
>     pkg2.func(x)
>
> It seems to me that this notation is misleading because a 
> reader might think that the function in pkg1 will be executed.
>

Unless I'm seriously missing something here, the function in pkg1 
will be executed if in fact there *is* one in pkg1.  If there isn't, 
and the user doesn't have detailed knowledge of the derivation of x, 
then the user has to go looking for where func actually is defined.  
I see no real difference between this and the class-based model.

>
>The choice is between giving the reader less information, versus 
>giving him misleading information.
>
>- Mitch

Indeed, it is misleading only to someone who doesn't bother to find 
out what the syntax & semantics are, & relate it to what s/he already 
knows in other languages.

---------------------------------------------------------------------
Kevin J. Weise                email:  kweise@sed.redstone.army.mil
COLSA Corp.                   voice:  (205) 842-9083
Huntsville, AL 

.. standard disclaimers apply






  parent reply	other threads:[~1996-07-23  0:00 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-07-17  0:00 "use" clauses and Ada 95 OOP Mitch Gart
1996-07-19  0:00 ` Robert I. Eachus
1996-07-23  0:00   ` Robert I. Eachus
1996-07-25  0:00     ` JamesS1889
1996-07-23  0:00   ` JamesS1889
1996-07-23  0:00     ` Robert Dewar
1996-07-24  0:00     ` Robert I. Eachus
1996-07-24  0:00   ` Jon S Anthony
1996-07-19  0:00 ` James A. Squire
1996-07-22  0:00   ` Stephen Schmid
1996-07-23  0:00     ` JamesS1889
1996-07-23  0:00     ` Mitch Gart
1996-07-23  0:00       ` Robert A Duff
1996-07-23  0:00       ` Robert Dewar
1996-07-25  0:00         ` JamesS1889
1996-07-26  0:00           ` Robert A Duff
1996-07-23  0:00       ` Kevin J. Weise [this message]
1996-07-23  0:00         ` JamesS1889
1996-07-23  0:00       ` Kevin J. Weise
1996-07-23  0:00     ` JamesS1889
1996-07-23  0:00     ` Laurent Guerby
1996-07-23  0:00       ` Robert A Duff
1996-07-24  0:00     ` Jon S Anthony
1996-07-24  0:00     ` Jon S Anthony
1996-07-19  0:00 ` Jon S Anthony
1996-07-20  0:00 ` James A. Squire
1996-07-21  0:00   ` Robert A Duff
1996-07-22  0:00 ` Jon S Anthony
1996-07-23  0:00 ` Jon S Anthony
replies disabled

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