From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.5-pre1 (2020-06-20) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-1.9 required=3.0 tests=BAYES_00,MSGID_SHORT autolearn=no autolearn_force=no version=3.4.5-pre1 Date: 27 Jan 93 22:15:35 GMT From: erickson@taurus.cs.nps.navy.mil (David Erickson) Subject: private types and recompilation Message-ID: <7277@grus.cs.nps.navy.mil> List-Id: 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