From: Nicolas Gautier <Nicolas.Gautier@eurocontrol.fr>
Subject: Interface definition
Date: 1996/07/22
Date: 1996-07-22T00:00:00+00:00 [thread overview]
Message-ID: <31F3A4F7.58B5@eurocontrol.fr> (raw)
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.
reply other threads:[~1996-07-22 0:00 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox