Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cross-project-issues-dev] OCL 2.1 11.7.3 OrderedSet addition well-formedness rules


The OrderedSet well-formedness constraints in 11.7.3 appear to have been copied and pasted from Sequence. They need revision to consider the Set consequences of .

Addition operations (includes, insertAt, union, append, prepend) have a post-condition that the size increases, which is clearly not the case if an additional element is equal to a pre-existing element.

In the particular case of insertAt there is an ambiguity as to whether the insert index is the pre or post index. For instance when inserting 3 at index 5 into OrderedSet{1, 2, 3, 4, 5, 6} the pre-index insertion yields OrderedSet{1,2,4,3,5,6} whereas the post-index insertion yields OrderedSet{1,2,4,5,3,6}. While the post-index insertion satisfies the 'post: result->at(index) = object' constraint, it is presumably not the intent.


        Ed Willink

Back to the top