comp.lang.ada
 help / color / mirror / Atom feed
From: eachus@spectre.mitre.org (Robert I. Eachus)
Subject: Re: Choice of OO primitives in Ada95
Date: 1996/02/21
Date: 1996-02-21T00:00:00+00:00	[thread overview]
Message-ID: <EACHUS.96Feb21114109@spectre.mitre.org> (raw)
In-Reply-To: Dn0FqH.8Cw@assip.csasyd.oz


In article <Dn0FqH.8Cw@assip.csasyd.oz> donh@syd.csa.com.au (Don Harrison) writes:

  > This is an example of what I mean by tight-coupling of
  > abstractions - you are forced to encapsulate both abstractions
  > into a single module.

   Not FORCED to, choose to.

  > An example might best illustrate what I mean. Extending your
  > example and assuming each type is tagged, we might have:

  > package X is
  >   type MARRIAGE is tagged ...
  >   type PERSON is tagged ...
  >   type UNIVERSITY is tagged ...
  >   type GOVERNMENT is tagged ...
  >   type ELECTORATE is tagged ...
  >   type ADDRESS is tagged ...

  >    procedure Enrol (Student : in out PERSON; Uni : in out UNIVERSITY);
  >    procedure Award_Grant (Polies : in out GOVERNMENT; Uni : in out UNIVERSITY);
  >    procedure Make_Gerrymander (Polies : in out GOVERNMENT; Elect : in out ELECTORATE);
  >    function Office_Address (Elect : in ELECTORATE) return ADDRESS;

  > end X;

  > 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. But many of them have nothing to do with each other. They
  > are tightly-coupled even though they should be distinct and this
  > has been forced by the language rules.

    What language rules say this?  The only thing remotely close is
that when you have two types where you want primitive operations of
one with operands of the other, you have to chose one of several
approaches.  ONE of those approaches is to package the types together,
and if they are closely related, it is usually the right choice.
Other choices include using child packages, making the operations on
one type class-wide operations using a parent of the other type,
treating the relation between the two types as its own class,
generics, etc...

    But how would you attack this "problem" in C++?  The "solutions" I
have seen all have the same semantic effect as the Ada solution shown
even though the file layout is usually different.  (The mingling of
the types is via #includes.)

--

					Robert I. Eachus

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




  parent reply	other threads:[~1996-02-21  0:00 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <DMqHqF.9F1.0.-s@inmet.camb.inmet.com>
     [not found] ` <DMu9yw.5ts@assip.csasyd.oz>
     [not found]   ` <4g2f8v$15lc@watnews1.watson.ibm.com>
1996-02-19  0:00     ` Choice of OO primitives in Ada95 Don Harrison
1996-02-19  0:00       ` Robert A Duff
1996-02-20  0:00         ` Don Harrison
1996-02-20  0:00           ` Jon S Anthony
1996-02-22  0:00             ` Real OO (was Choice of OO primitives in Ada95) Don Harrison
1996-02-22  0:00               ` Robert Dewar
1996-02-23  0:00                 ` Gene Ouye
1996-02-26  0:00                   ` James O'Connor
1996-02-26  0:00                     ` Gene Ouye
1996-02-22  0:00               ` Jon S Anthony
1996-02-24  0:00               ` Valery Croizier
1996-02-24  0:00               ` Robert A Duff
1996-02-26  0:00                 ` Don Harrison
1996-02-26  0:00                 ` Matthew B. Kennel
1996-02-26  0:00               ` So called Real OO (was blah blah blah...) Jon S Anthony
1996-02-20  0:00           ` Choice of OO primitives in Ada95 Ray Toal
1996-02-21  0:00             ` Don Harrison
1996-02-23  0:00               ` Robert A Duff
1996-02-22  0:00             ` Bernd Holzmueller
1996-02-23  0:00               ` Robert A Duff
1996-02-23  0:00           ` Robert A Duff
1996-02-19  0:00       ` Norman H. Cohen
1996-02-21  0:00       ` Robert I. Eachus [this message]
1996-02-21  0:00     ` John DiCamillo
1996-02-22  0:00       ` Don Harrison
1996-02-24  0:00         ` Robert A Duff
     [not found] <4fmrhk$7k3@erinews.ericsson.se>
1996-02-19  0:00 ` Richard A. O'Keefe
replies disabled

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