Thu, 12 Nov 1998 12:05:49 -0500
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
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
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
function Message (Text: in Clever_Ideas) return Better_Ideas is...