From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,5382b9bb1e96c86f,start X-Google-Attributes: gid103376,public From: Nicolas Gautier Subject: Interface definition Date: 1996/07/22 Message-ID: <31F3A4F7.58B5@eurocontrol.fr>#1/1 X-Deja-AN: 170050601 content-type: text/plain; charset=us-ascii organization: Eurocontrol mime-version: 1.0 newsgroups: comp.lang.ada x-mailer: Mozilla 2.0 (X11; I; HP-UX A.09.05 9000/755) Date: 1996-07-22T00:00:00+00:00 List-Id: Hello, We are are designing a subsystem, which is to be linked into different client applications. In defining an interface to this subsystem, we require each client to implement types and associated operations which conform to our specifications. We have two possible ways of writing the specifications. 1/ We write the specifications of the packages and each client implements its own body. -- example1 package ClientTypes is type ClientType is private; private type ClientTypeRecord; type ClientType is access ClientTypeRecord; end ClientTypes; 2/ We write the specifications using abstract types and abstract procedures, which leaves the client greater freedom when defining the derived types. --example2 package AbstractClientTypes is type AbstractClientType is abstract tagged null record; end AbstractClientTypes; Problems 1/ The first method forces us to make decisions about the representation of the type. In the example above, in order to hide the data structure (about which we know nothing), ClientType is a pointer. 2/ Consider the following function : type ClientType1 is new AbstractClientType3 with private; type ClientType2 is new AbstractClientType3 with private; type ClientType3 is new AbstractClientType3 with private; function F (A : ClientType1; B : ClientType2) return ClientType3; We cannot use abstract types to oblige the client to provide such a function without requiring that it be applicable to the abstract classwide types. i.e., a client would have to provide an implementation of the function which could work with other clients' types. Suggestions grateffully received.