Issue 16348: OCL 2.3 Collecting elemental collections (ocl2-rtf) Source: Model Driven Solutions (Dr. Edward Willink, ed(at)willink.me.uk) Nature: Uncategorized Issue Severity: Summary: collect and collectNested have irregular semantics that ignore the natural (outer) collection element type when used on nested collections: i.e Set{Set{1.0}}->collect(toString()) is Set{Set{1.0}}->collect(s : String | s.toString()) so how might an iteration over the outer collection element type be performed? Presumably, for homegeneous collections, by explicitly specifying the iterator type as Set{Set{1.0}}->collect(s : Set(String) | s->size()) Suggest: collect, collectNested specify that the implicit iterator type is the innermost collection type, and that an explicit type may specify a collection type that successfully iterates when all leaves of the tree are uniquely contained in a corrsponding iteration element of the iterator type, else the iteration is invalid. Can't see a solution for heterogeneous solutions Resolution: Revised Text: Actions taken: June 25, 2011: received issue Discussion: End of Annotations:===== ronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AmwIAIGmBU5UXeb0/2dsb2JhbABSmF6OaXeIdqMLnnuGMASWcYsu Date: Sat, 25 Jun 2011 10:15:49 +0100 From: Ed Willink User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-GB; rv:1.9.2.13) Gecko/20101207 Thunderbird/3.1.7 To: issues@omg.org Subject: OCL 2.3 Collecting elemental collections Hi collect and collectNested have irregular semantics that ignore the natural (outer) collection element type when used on nested collections: i.e Set{Set{1.0}}->collect(toString()) is Set{Set{1.0}}->collect(s : String | s.toString()) so how might an iteration over the outer collection element type be performed? Presumably, for homegeneous collections, by explicitly specifying the iterator type as Set{Set{1.0}}->collect(s : Set(String) | s->size()) Suggest: collect, collectNested specify that the implicit iterator type is the innermost collection type, and that an explicit type may specify a collection type that successfully iterates when all leaves of the tree are uniquely contained in a corrsponding iteration element of the iterator type, else the iteration is invalid. Can't see a solution for heterogeneous solutions. Regards Ed Willink