comp.lang.ada
 help / color / mirror / Atom feed
From: Hyman Rosen <hymie@prolifics.com>
Subject: Re: Ada OO Mechanism
Date: 1999/05/25
Date: 1999-05-25T19:37:41+00:00	[thread overview]
Message-ID: <t7g14lrlag.fsf@calumny.jyacc.com> (raw)
In-Reply-To: 7iems7$1vm@news2.newsguy.com

Samuel Mize <smize@imagin.net> writes:
> THE QUESTION: how does one do "mix-in" classes in C++?  I'd bet a
> nickel that you can, but I don't know the specific mechanism.  The
> "mix-in" metaphor is described in the Ada 95 Rationale, 4.6.2.

I believe this Ada --

   generic
      type S is abstract tagged private;
   package P is
      type T is abstract new S with private;
      -- operations on T
   private
      type T is abstract new S with
         record
            -- additional components
         end record;
   end P;

corrsponds to this C++ --

   template <typename S>
   class P
   {
   public:
      class T : public S
      {
      private:
         // additional components
      }
   };

and given some type A, one could declare objects of type P<A>::T.
These objects are derived from A and also implement the extra
operations of T. I haven't bothered to duplicate the 'abstract',
but that's easily done by giving T an abstract destructor, ~T() = 0.

> - The class is the primary form of data encapsulation.

Classes support static data and function members, and nested classes.
I believe that this gives C++ the equivalent of Ada's packages.

> - Each "message" (implemented as a dispatching function call) goes
>   to exactly one object (or class).  Any other objects mentioned are
>   passive arguments.

How is this different from Ada? Does Ada allow dispatching on more than
one argument?

> - When an object sends a message, it waits for the called object
>   to complete its processing of the message (that is, for the return
>   of the function call) before continuing.
> - One thread of control calls all objects; they are not independent
>   active entities.

Well, no argument there. C++ does not have a language-defined parallel
processing capability, and Ada is absolutely superior in that regard.
However, I would say that this is generally considered orthogonal to
object-oriented programming, since your statement above is equally true
if you replace objects and messages with plain function calls.

> I'm sure one could create, in C++
...
> But each of these would be working against the object-oriented model
> built into the language.

Instead, C++ programmers generally use third-party or system packages
which allow parallel processing. These have no impact upon the OO model
at all, and certainly don't forbid anything you might normally do. You
do have to be careful about protecting shared resources, but that's true
in Ada as well. I think including parallel behavior in your definition
of OO is stretching that definition beyond any accepted usage.

> I'm not saying that C++ is "lesser," "worse" or "wrong," I'm just saying
> that it takes a different, but equally valid, design approach.  The
> same is true for Ada.

To quote you,
  > There are other OO design approaches that are harder to implement in
  > C++ than in Ada, because C++ strongly supports one specific view of
  > object-oriented technology.

See? You said there are OO approaches that are harder to implement in C++
than in Ada. If you're talking about implementing parallel processing,
fine, I agree. Otherwise, I would like to see an example, so that I can
determine whether that's really true, or whether it comes from an
incomplete understanding of C++.




  reply	other threads:[~1999-05-25  0:00 UTC|newest]

Thread overview: 116+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-05-20  0:00 Ada OO Mechanism Shawn M. Root
1999-05-20  0:00 ` Samuel Mize
1999-05-20  0:00   ` David Botton
1999-05-20  0:00     ` Samuel Mize
1999-05-20  0:00       ` David Botton
1999-05-24  0:00   ` Hyman Rosen
1999-05-24  0:00     ` Robert Dewar
1999-05-24  0:00       ` Hyman Rosen
1999-05-24  0:00         ` Mike
1999-05-25  0:00           ` Robert Dewar
1999-05-24  0:00         ` David Starner
1999-05-24  0:00           ` bob
1999-05-24  0:00             ` David Starner
1999-05-25  0:00               ` Ole-Hjalmar Kristensen
1999-05-25  0:00                 ` Florian Weimer
1999-05-25  0:00                 ` Mark A Biggar
1999-05-25  0:00                   ` Hyman Rosen
1999-05-25  0:00                     ` Richard D Riehle
1999-05-25  0:00                       ` David Botton
1999-05-26  0:00                         ` Tom Moran
1999-05-27  0:00                       ` Aidan Skinner
1999-05-25  0:00                     ` Samuel Mize
1999-05-25  0:00                       ` Hyman Rosen
1999-05-25  0:00                         ` Richard D Riehle
1999-05-25  0:00                           ` Hyman Rosen
1999-05-26  0:00                             ` Ray Blaak
1999-05-26  0:00                               ` Hyman Rosen
1999-05-26  0:00                               ` Richard D Riehle
1999-05-26  0:00                                 ` Hyman Rosen
1999-05-27  0:00                                   ` Richard D Riehle
1999-06-05  0:00                                     ` Matthew Heaney
1999-06-07  0:00                                       ` Hyman Rosen
1999-05-28  0:00                                   ` Laurent Guerby
1999-06-05  0:00                                   ` Matthew Heaney
1999-06-07  0:00                                     ` Hyman Rosen
1999-06-08  0:00                                       ` Robert Dewar
1999-06-08  0:00                                         ` Stanley R. Allen
1999-06-08  0:00                                         ` Markus Kuhn
1999-06-08  0:00                                           ` Stanley R. Allen
1999-06-08  0:00                                       ` Matthew Heaney
1999-06-08  0:00                                         ` Hyman Rosen
1999-06-08  0:00                                           ` Samuel Mize
1999-06-08  0:00                                             ` Hyman Rosen
     [not found]                           ` <t7zp2sr6yf.fsf@calumny.jyacc.c <t7emjmmx8w.fsf@calumny.jyacc.com>
1999-06-08  0:00                             ` Larry Kilgallen
1999-06-08  0:00                               ` Hyman Rosen
1999-06-08  0:00                                 ` Tucker Taft
1999-06-08  0:00                                   ` Brian Rogoff
1999-06-09  0:00                                   ` Robert Dewar
     [not found]                                   ` < <375E92CB.27850620@averstar.com>
1999-06-09  0:00                                     ` Brian Rogoff
1999-06-14  0:00                                       ` Robert A Duff
1999-06-09  0:00                                   ` Tucker Taft
1999-06-09  0:00                                 ` Samuel Mize
1999-06-09  0:00                                 ` Matthew Heaney
     [not found]                           ` <t7zp2sr6yf.fsf@calumny.jyacc.c <t7r9nmz8ou.fsf@calumny.jyacc.com>
1999-06-08  0:00                             ` Larry Kilgallen
1999-06-08  0:00                               ` Hyman Rosen
1999-06-14  0:00                                 ` Robert A Duff
     [not found]                           ` <t7zp2sr6yf.fsf@calumny.jyacc.c <375d9a3d.e1cccc63@averstar.com>
1999-06-09  0:00                             ` Larry Kilgallen
1999-06-09  0:00                               ` Tucker Taft
1999-05-25  0:00                         ` Brian Rogoff
1999-05-25  0:00                           ` Jim
1999-05-26  0:00                           ` Robert Dewar
1999-05-26  0:00                             ` Brian Rogoff
1999-05-25  0:00                         ` Samuel Mize
1999-05-25  0:00                           ` Chris
1999-05-25  0:00                             ` David Botton
1999-05-27  0:00                               ` Aidan Skinner
1999-05-27  0:00                                 ` Gautier
1999-05-27  0:00                             ` Samuel Mize
1999-05-27  0:00                         ` Samuel Mize
1999-05-27  0:00                           ` Jon S Anthony
1999-05-27  0:00                         ` Samuel Mize
1999-05-27  0:00                           ` Hyman Rosen
1999-05-28  0:00                             ` Samuel Mize
1999-05-28  0:00                             ` Laurent Guerby
1999-05-28  0:00                               ` Richard D Riehle
1999-05-28  0:00                                 ` Tom Moran
1999-05-28  0:00                     ` Robert I. Eachus
1999-05-28  0:00                       ` Brian Rogoff
1999-05-29  0:00                       ` Ehud Lamm
1999-05-30  0:00                         ` chris
1999-05-30  0:00                           ` Harry George
1999-05-30  0:00                             ` Vladimir Olensky
1999-05-31  0:00                               ` Robert Dewar
1999-05-30  0:00                           ` Robert Dewar
1999-05-31  0:00                           ` Vladimir Olensky
1999-06-03  0:00                             ` Dale Stanbrough
1999-06-02  0:00                               ` mike
1999-06-03  0:00                                 ` Robert Dewar
1999-06-06  0:00                                   ` David Botton
1999-06-07  0:00                                     ` Robert Dewar
1999-06-01  0:00                           ` Richard D Riehle
1999-06-03  0:00                         ` Matthew Heaney
1999-06-03  0:00                     ` Matthew Heaney
1999-05-25  0:00     ` Samuel Mize
1999-05-25  0:00       ` Hyman Rosen [this message]
1999-05-25  0:00         ` David Starner
1999-05-26  0:00         ` Ole-Hjalmar Kristensen
1999-05-26  0:00         ` Laurent Guerby
1999-05-26  0:00           ` Hyman Rosen
1999-05-28  0:00             ` Laurent Guerby
1999-06-01  0:00               ` Hyman Rosen
1999-06-03  0:00                 ` Fraser Wilson
1999-06-03  0:00     ` Matthew Heaney
1999-06-03  0:00       ` Hyman Rosen
1999-05-21  0:00 ` Dale Stanbrough
1999-05-20  0:00   ` bob
1999-05-21  0:00     ` Dale Stanbrough
1999-05-21  0:00   ` Richard D Riehle
1999-05-21  0:00     ` Shawn M. Root
1999-05-21  0:00       ` Richard D Riehle
1999-05-25  0:00         ` Shawn M. Root
1999-05-21  0:00     ` Marin David Condic
1999-05-21  0:00       ` Steve
1999-05-21  0:00       ` Dan Nagle
1999-05-24  0:00         ` Marin David Condic
1999-05-25  0:00   ` Don Overheu
replies disabled

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