Real OO (was Re: Choice of OO primitives in Ada95) 
Author Message
 Real OO (was Re: Choice of OO primitives in Ada95)



[my incorrect example of chained classes deleted]

: >Each abstraction is related to the previous one but isn't necessarily related
: >to any other. As I understand it, the language rules dictate that each of these
: >abstractions must be in the same package.
:
: No, they don't have to be in the same package (and as you say, probably
: should not be).  Could you explain what you mean -- why do you think
: that all of the above types have to be in the same package?
: (By the way, the above code is illegal, by 3.9.2(12).)

I thought on the basis of RM 3.2.3(6):

"The primitive subprograms of a specific type are defined as follows:
(...)
For a specific type declared immediately within a package specification, any
subprograms ... that are explicitly declared immediately within the same package specification and that operate on that type".

that an operation could be an inheritable (primitive) operation of more than one
inheritable (tagged) abstraction. RM 3.9.2(12), as you point out, means that an
operation can only be a primitive operation of one tagged type. Thanks for the correction.

What this implies, however, is that even though parameters of non-inheritable
(non-primitive) operations are symmetric with respect to each other, this symmetry
is lost when one or more tagged types are used. In the context of inheritance,
dispatching operations DO BELONG to a SPECIFIC abstraction and the operands are NOT
SYMMETRIC with repect to one another. (They not only DO belong to a specific abstraction, but MUST belong to a specific abstraction for the purposes of polymorphism).

RM 3.9.2(12) means that with:
  type PERSON is tagged ...
  type MARRIAGE is tagged ...

you cannot have:
  procedure Wed (
    Groom : PERSON;
    Bride : PERSON;
    M     : out MARRIAGE);

in which case, Wed would be inheritable by descendants of both PERSON and MARRIAGE
because they are both tagged. You must remove the primitive status from one of the
operand types the eg.

  procedure Wed (
    Groom : PERSON;
    Bride : PERSON;
    M     : out MARRIAGE'Class);

In the context of inheritance, operands are intrinsically ASYMMETRICAL, NOT
SYMMETRICAL. In fact, the asymmetry of operands actually favours distinct
encapsulation as a model rather than co-encapsulation because the operation
belongs (in the sense of being inheritable) to a single tagged type.

[...]

: - Bob

Don.



Tue, 18 Aug 1998 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Real OO (was Choice of OO primitives in Ada95)

2. Choice of OO primitives in Ada95

3. SENIOR OO SOFTWARE DEVELOPER WITH OO SAVVY - TORONTO

4. OO SOFTWARE DEVELOPER WITH OO SAVVY - TORONTO

5. OO SOFTWARE DEVELOPER WITH OO SAVVY - TORONTO

6. OO SOFTWARE DEVELOPER WITH OO SAVVY - TORONTO

7. Use of O.O. metrics to estimate the effert and cost of O.O. projects

8. Pure OO-What differentiates a true OO from object-based systems

9. Wanted: Non-trivial OO Ada95 Open Source programs on the web

10. OO Samples in Ada95...

11. Talk on Ada95 and OO Programming (San Diego)

12. on OO differnces between Ada95 and C++

 

 
Powered by phpBB® Forum Software