Hi Neil, Christian, Nicolas
I stumbled over the experimental closure() implementation a few days
ago. It seems interesting. I see this has been raised as OMG Issue
13944. The RTF committee is so busy that if we want to get this in
OCL 2.3 there are better chances if the submission is formatted ready
for inclusion in the RTF report.
I think the recursive specification difficulty can be easily cured by
using infinite recursion of a helper function and a set that makes
further recursion redundant.
After trying to use the closure iterator, I think that an object
iterator form of closure is more fundamental than the collection
iterator. This allows the start object to be included in the results, so
a root and all its kids would be returned by
root.closure(it | it.kids)
whereas all the kids could be returned by
root.kids->forall(kid | kid.closure(it | it.kids))->asSet()
The collection iterator is nonetheless useful allowing the shorter
root.kids->closure(it | it.kids)
An object iterator is of course a new concept and so might bypass the
specification in terms of iterate ordanance.
Do you think it worth appending an update to Issue 13944 along these lines?
Regards
Ed Willink
---------------------------------------------------------------------
On Mon, 14 Jul 2008 15:59:16 -0400, Christian W. Damus wrote: