comp.lang.ada
 help / color / mirror / Atom feed
* "use" clauses and Ada 95 OOP
@ 1996-07-17  0:00 Mitch Gart
  1996-07-19  0:00 ` James A. Squire
                   ` (5 more replies)
  0 siblings, 6 replies; 29+ messages in thread
From: Mitch Gart @ 1996-07-17  0:00 UTC (permalink / raw)



In Ada 95 OOP we can have the situation where a call

    pkg1.func(x)

dispatches at runtime to

    pkg2.func(x)

because x is a classwide tagged type whose base type is in pkg1 but whose 
runtime tag says it's in fact a derived type in pkg2.

It seems to me that this notation is misleading because a reader might
think that the function in pkg1 will be executed.  

Therefore with tagged types I have adopted the style of always using
"use" clauses and writing the call

    func(x);

in the source code.  This seems less misleading to me.  I never used to
use "use" clauses in Ada 83 but I now use them a lot in Ada 95 when 
calling dispatching operations.

Have other people adopted this style?  Comments?  People who have written
coding standards which say "don't use 'use' clauses", do you think this
rule is still a good idea with Ada 95 dispatching?

To me the C++/Java syntax

    x.func

seems clearer than the Ada syntax in this case because what is being
called is the function that is associated with X at runtime, rather than
the function that comes from a given package.

-- Mitch Gart 
-- mg@inmet.com




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

end of thread, other threads:[~1996-07-26  0:00 UTC | newest]

Thread overview: 29+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-07-17  0:00 "use" clauses and Ada 95 OOP Mitch Gart
1996-07-19  0:00 ` James A. Squire
1996-07-22  0:00   ` Stephen Schmid
1996-07-23  0:00     ` Mitch Gart
1996-07-23  0:00       ` Kevin J. Weise
1996-07-23  0:00         ` JamesS1889
1996-07-23  0:00       ` Kevin J. Weise
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     ` JamesS1889
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-19  0:00 ` Robert I. Eachus
1996-07-23  0:00   ` JamesS1889
1996-07-23  0:00     ` Robert Dewar
1996-07-24  0:00     ` Robert I. Eachus
1996-07-23  0:00   ` Robert I. Eachus
1996-07-25  0:00     ` JamesS1889
1996-07-24  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

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