On 25-May-1999, Koen Claessen <[EMAIL PROTECTED]> wrote:
> Christian Maeder wrote:
>
> | An abstract data type should not reveal its realization.
>
> Indeed! And therefore, an abstract datatype should not impose silly
> restrictions on the context where they are not needed. How I implement a
> set (for example using ordered binary trees or a hash table), is part of
> the concrete representation of the datatype.
Certainly we should never impose _silly_ restrictions where they are not
needed. But not all restrictions are silly. Some restrictions constitute
an important part of the interface. Saying that a particular abstract
data type requires an ordering relation on its elements may well be an
important part of the interface. And doing so does not reveal the
implementation. The implementation could be a list, a red-black tree,
a 23-tree, a 234-tree, an AVL tree, or some other kind of data structure.
Stating the requirement for an ordering is just specifying the interface
requirements for that type, not disclosing the implementation.
Of course, the presence or absense of particular interface requirements
will certainly constrain the kinds of implementations that are possible,
but that should come as no surprise.
--
Fergus Henderson <[EMAIL PROTECTED]> | "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh> | of excellence is a lethal habit"
PGP: finger [EMAIL PROTECTED] | -- the last words of T. S. Garp.