TEAM-ADA Archives

Team Ada: Ada Programming Language Advocacy


Options: Use Forum View

Use Monospaced Font
Show Text Part by Default
Condense Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
"Team Ada: Ada Advocacy Issues (83 & 95)" <[log in to unmask]>
Mark Lundquist <[log in to unmask]>
Thu, 12 Nov 1998 12:05:49 -0500
"Robert I. Eachus" <[log in to unmask]>
"Robert I. Eachus" <[log in to unmask]>
text/plain; charset="us-ascii"
text/plain (39 lines)
At 09:35 AM 11/11/98 -0800, Mark Lundquist wrote:
>Ada supports the abstraction of "class" quite readily, even though it
>doesn't have a specialized "class" construct.  I think it's the
>abstraction that is important, not the syntax.  So I have to disagree;
>the lack of a special "class" construct in Ada does *not* make it very
>hard to do OO in Ada!...

   Ada 95 does have a class construct, it is spelled tagged.  Adding
special notation for declaring classes in Ada would have created either
some unnecessary restrictions or backward compatibility problems.  For
example in
Ada it is possible to declare a derived type (subtype) of a private type.
Having the notation identical whether or not the completion of the type is
tagged eliminates problems that would otherwise occur in generics.  (It is, of
course, possible to make a private type or generic formal private type
tagged, but that is another issue.)

>The key concepts of OO are ("all together now..." :-) encapsulation,
>inheritance, and polymorphism, right?  Having "class" as a keyword, a
>syntax that encloses the declarations of operations within the
>declaration of a data type, and/or prefix notation for invoking
>primitive operations (whatever they may be called -- methods,
>member functions, etc.) are not the key concepts -- just incidental
>implementation details.

   Actually in Ada 95 the 'Class notation is directly tied to run-time
polymorphism, with the possible exception of:

   if X in Y'Class ...

   which (surprise) tests whether the value of X is a value of type Y, or a
value of any subclass of Y.

                                        Robert I. Eachus

with Standard_Disclaimer;
use  Standard_Disclaimer;
function Message (Text: in Clever_Ideas) return Better_Ideas is...