Issue 15836: OCL 2.3 Incomplete CollectionRange well-formedness rules (ocl2-rtf) Source: Model Driven Solutions (Dr. Edward Willink, ed(at)willink.me.uk) Nature: Uncategorized Issue Severity: Summary: The descriptions of CollectionRange are generally vague leaving the end inclusivities unclear. It is only the CollectionRangeEval::getRange that provides a solid definition of well-formedness for e.g. Sequence{1..1} as equal to Sequence{1}. Unfortunately the specification is undecided about Sequence{2..1} since the CollectionRangeEval::getRange recursion never terminates. Rather than impose a well-formedness constraint that Sequence{2..1} is invalid, perhaps it should be made useful instead, by defining .. as operating in the direction of the last wrt the first so Sequence{2..1} = Sequence{2,1} and Set{1..2} = Set{2..1} = Set{1,2}. Resolution: The generalization to allow down-counts can lead to nasty surprises for e.g. Sequence{1..x->size()} when x is empty. So just make it clear that Sequence{2..1} is invalid Revised Text: 8.4 CollectionRange replace A CollectionRange represents a range of integers. by A CollectionRange represents a range of integers from a first integer up to and including a last integer. In 8.4.2 CollectionRange add The last value follows the first value. inv IncreasingRange: first <= last Actions taken: November 18, 2010: received issue December 23, 2013: closed issue Discussion: End of Annotations:===== ronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AqoFAGuE5EzUnw4T/2dsb2JhbACUUo4BcbxMhUsE Date: Thu, 18 Nov 2010 09:43:48 +0000 From: Ed Willink User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-GB; rv:1.9.2.12) Gecko/20101027 Thunderbird/3.1.6 To: issues@omg.org Subject: OCL 2.3 Incomplete CollectionRange well-formedness rules Hi The descriptions of CollectionRange are generally vague leaving the end inclusivities unclear. It is only the CollectionRangeEval::getRange that provides a solid definition of well-formedness for e.g. Sequence{1..1} as equal to Sequence{1}. Unfortunately the specification is undecided about Sequence{2..1} since the CollectionRangeEval::getRange recursion never terminates. Rather than impose a well-formedness constraint that Sequence{2..1} is invalid, perhaps it should be made useful instead, by defining .. as operating in the direction of the last wrt the first so Sequence{2..1} = Sequence{2,1} and Set{1..2} = Set{2..1} = Set{1,2}. Regards Ed Willink