comp.lang.ada
 help / color / mirror / Atom feed
* Interface definition
@ 1996-07-22  0:00 Nicolas Gautier
  0 siblings, 0 replies; only message in thread
From: Nicolas Gautier @ 1996-07-22  0:00 UTC (permalink / 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.




^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1996-07-22  0:00 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-07-22  0:00 Interface definition Nicolas Gautier

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