comp.lang.ada
 help / color / mirror / Atom feed
From: erickson@taurus.cs.nps.navy.mil (David Erickson)
Subject: private types and recompilation
Date: 27 Jan 93 22:15:35 GMT	[thread overview]
Message-ID: <7277@grus.cs.nps.navy.mil> (raw)

When Ada 83 was designed, why did the designers choose to put
the details of private types in package specifications, rather than
in package bodies (which is more in the spirit of information hiding, and
better supports independent compilation).

As it stands now, if I write a program that withs a package that specifies
private types, I must recompile that program if the details of the private 
types are modified, even if there is no change to the non-private 
specifications of the package.

For example, if a linked list implementation is chosen, a LIST package
might look like this:

generic
  type ATOM is private;
package LIST_ADT is
  type POSITION is private;
  type LIST is private;
  procedure CREATE(L: in out LIST);
  procedure INSERT_AFTER(L: in out LIST; P: POSITION; A: ATOM);
  ...

private
  type LIST;
  type POSITION is access LIST;
  type LIST is record
    A: ATOM;
    NEXT: POSITION;
  end record;
end LIST_ADT;


but a program that uses the LIST package does not see the details of the 
private types, so why should a change in those details, say to an array
implementation, cause the program to be recompiled.

The problem could be avoided if the private portion of the package was 
moved to the package body or if it could be declared "is separate".

-Dave Erickson

             reply	other threads:[~1993-01-27 22:15 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1993-01-27 22:15 David Erickson [this message]
  -- strict thread matches above, loose matches on Subject: below --
1993-01-28  1:22 private types and recompilation Kenneth Anderson
1993-01-28  8:07 Christian S. Collberg
1993-01-28 14:13 David Emery
1993-01-28 15:25 Tucker Taft
1993-01-28 15:58 Pat Rogers
1993-01-28 18:08 Mark A Biggar
1993-01-28 23:44 Alex Blakemore
replies disabled

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