Issue 15222: OCL 2.2 11.7.1 Why must + be associative for Collection::sum() (ocl2-rtf) Source: Model Driven Solutions (Dr. Edward Willink, ed(at)willink.me.uk) Nature: Uncategorized Issue Severity: Summary: Collection::sum() requires that its T::+() is commutative and associative. Associativity is necessary for predictable results. However what if it isn't? Is there an obligation on the OCL runtime to detect non-associativity and return invalid? - probably not possible. Is there a permission on the OCL runtime to detect non-associativity and return invalid? - difficult to ensure implementation portability Is there just an informal caution to users that non-associativity may lead to unpredictable results? Suggest: reword to permit an implementation to return invalid and caution users about unpredictable results. Resolution: Revised Text: At the end of 11.6.1 Collection, sum() : T insert If the + operation is not both associative and commutative, the sum expression is not well-formed, which may result in unpredictable results during evaluation. If an implementation is able to detect a lack of associativity or commutativity, the implementation may bypass the evaluation and return an invalid result. Actions taken: April 23, 2010: received issue April 25, 2011: closed issue Discussion: No. Both associativity and commutativity are necessary for predictable results on arbitrary collections. (Issue 15223 relaxes both for ordered collections.) Yes. It does not seem reasonable to require an implementation to detect a lack of associativity or commutativity, so reword to permit and warn as suggested. End of Annotations:===== ronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AkIFAM400UvUnw4T/2dsb2JhbACQK4t/cb0mhQsE Date: Fri, 23 Apr 2010 13:51:07 +0100 From: Ed Willink User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-GB; rv:1.9.1.5) Gecko/20091204 Thunderbird/3.0 To: issues@omg.org Subject: OCL 2.2 11.7.1 Why must + be associative for Collection::sum() X-Plusnet-Relay: 21bf36f9302529f0e425e864fab64745 Hi Collection::sum() requires that its T::+() is commutative and associative. Associativity is necessary for predictable results. However what if it isn't? Is there an obligation on the OCL runtime to detect non-associativity and return invalid? - probably not possible. Is there a permission on the OCL runtime to detect non-associativity and return invalid? - difficult to ensure implementation portability Is there just an informal caution to users that non-associativity may lead to unpredictable results? Suggest: reword to permit an implementation to return invalid and caution users about unpredictable results. Regards Ed Willink