[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ADT Lib (6)



MVA> With such semantics, I can add these methods to container again.  The
MVA> question is: Is it worthwhile to have methods with such vague
MVA> semantics?  Does anyone second this?
MVA> 
MVA> Another question: With the above specification, is it guaranteed that
MVA> the statement sequence
MVA>   c.Add(foo); c. Remove(foo);
MVA> is a "no operation", i.e., will not change the state of `c' or the
MVA> system?

Hmmm.  Add followed by Remove should be a no operation.  The only
suggestion I see is to make Remove symmetrical to Add:

PROCEDURE (c: Container) Remove* (obj: AcObject.Object);
(* Removes obj from c.  Post-condition is that obj is not a
 member of c.  If obj is in in c multiple times, all copies are removed.
 If obj is not in c then nothing is done.
*)

The semantics are unusual and by being functions of AcContainer,
all ADTs are forced to provide an implementation!  So I'm not sure
the convenience of generic Add/Remove is worth it.

--Ian