comp.lang.ada
 help / color / mirror / Atom feed
From: bobduff@world.std.com (Robert A Duff)
Subject: Re: "use" clauses and Ada 95 OOP
Date: 1996/07/23
Date: 1996-07-23T00:00:00+00:00	[thread overview]
Message-ID: <Dv08sA.1DK@world.std.com> (raw)
In-Reply-To: Duzwxx.8E1.0.-s@inmet.camb.inmet.com


In article <Duzwxx.8E1.0.-s@inmet.camb.inmet.com>,
Mitch Gart <mg@asp.camb.inmet.com> 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.
...
>In Ada 83 if a reader sees the call
>
>    pkg1.func
>
>he can look at the body of pkg1 to see what statements will be executed.

But Mitch, Ada 83 doesn't have dispatching, so this isn't a fair
comparison.  In Ada 83, no matter what you write, you can tell
(statically) what body gets called (though if there are use_clauses the
analysis might be harder).  If you don't like the idea that the body
being called is unknown until run-time, then you simply don't like OOP.
It's not a syntactic matter.

Similarly, in C++, a naive user might think "x.func" calls the func in
the class of x.  The non-naive user knows that you have to look and see
if func is virtual, and if so, there's a run-time dispatch.

Both languages are similar in this regard -- some calls jump to a
particular place, and some jump to a run-time-known place.  And you
can't tell without looking at the declaration of the function being
called.  And in both languages, you have to understand the rules in
order to know which is which.

I must admit that a person who says "use_clauses are evil but
dispatching is good" is being a bit inconsistent.  Both use_clauses and
dispatching introduce some uncertainty (and flexibility).

- Bob




  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 ` Jon S Anthony
1996-07-19  0:00 ` James A. Squire
1996-07-22  0:00   ` Stephen Schmid
1996-07-23  0:00     ` Laurent Guerby
1996-07-23  0:00       ` Robert A Duff
1996-07-23  0:00     ` JamesS1889
1996-07-23  0:00     ` Mitch Gart
1996-07-23  0:00       ` Robert A Duff [this message]
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
1996-07-23  0:00       ` Kevin J. Weise
1996-07-23  0:00         ` JamesS1889
1996-07-23  0:00     ` JamesS1889
1996-07-24  0:00     ` Jon S Anthony
1996-07-24  0:00     ` Jon S Anthony
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-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