Mark Lundquist wrote:

> From:  "Robert I. Eachus" <[log in to unmask]>
> >    Ada 95 does have a class construct, it is spelled tagged.
> Well, sort of.  Part of the definition a class is the specification of
> its public methods, but a tagged record declaration does not include
> this.
>My use of the phrase "special
> class construct" is to be understood as identical with your phrase
> "special notation for declaring classes".

I personally wouldn't limit the term "language construct" to
syntax-level entities, so I can agree with both of you.

- You don't see a syntax-level "thing" that encapsulates a class.

- Robert sees a semantic "thing" that provides the functionality
  of a class (abstraction, inheritance, polymorphism, etc.)

For this reason, Ada has a PR problem among people who look at the
very shallowest surface of the language.  Some people in the Ada 9X
process argued strongly that Ada 95 should have a keyword or
syntax construct called "class," just to make it easier to sell
the language's O-O features -- for absolutely no technical reason.

I feel the Ada construct is the right technical choice.  The
fact is that Ada's system is MORE powerful.

- To fully and formally encapsulate classes, you use Ada's
  encapsulation mechanism -- the package.  Put each class in
  its own package.

- To tightly couple some classes, you can put them into the
  same package, so each can see the other's implementation.
  (This is often a bad idea, but it is occasionally quite
  useful -- rather like keeping GOTO in the language.)

- I have also used tagged types to simplify coding in a purely
  procedural program.  From what I've read about typical C++
  usage, this is not uncommon -- but in C++ it's more confusing,
  because you have to define bogus "classes" for non-objects.

Note that I'm not a O-O totalitarian.  Some people thing
EVERYTHING should be object oriented, NOTHING should be
procedural.  They will knock a language that lets you organize
your design in any other way.

I personally think that's hogwash, and I very much like the
integrated procedural and object-oriented facilities of Ada.

But it might have been helpful for PR to have a separate "class"
keyword -- maybe allow replacement of "package" with "class,"
and require that any such package's spec contains ONLY one
tagged type and its dispatching procedures.  One could view it
as a form of strong typing applied to packages.  But I don't
think it's that important of an omission.

Sam Mize

Samuel Mize -- [log in to unmask] (home email) -- Team Ada
Fight Spam: see \\\ Smert Spamonam