|
Re: Collection and UniqueCollection Union [message #1710239 is a reply to message #1710027] |
Mon, 05 October 2015 13:25 |
Ed Willink Messages: 7655 Registered: July 2009 |
Senior Member |
|
|
Hi
The Pivot OCL also prototypes OCL 2.5/3.0 changes such as the Modeled
Standard Library, so precise OCL 2.4 is not there. Precise OCL 2.4 is
almost unimplementable anyway because of specification ambiguities. You
could use an OCL-2.4.oclstdlib in place of OCL-2.5.oclstdlib to get closer.
OCL 2.4 has no OrderedSet::union or Collection::union.
I have been uncomfortable about the partial availability of 'set'
operations such as union on non-sets. Hence the more uniform
Collection::union returning a set-like Bag.
I would much prefer to replace 'union' by 'appendAll' for
OrderedCollections so that it is clearer that the user is responsible
for the subsequent ordering. To me 'union' implies that the unified
ordering is somehow consistent. i.e.
Sequence{1,3,5}->union(Sequence{2,4,6}) could be expected to be
Sequence{1,2,3,4,5,6} but it is actually Sequence{1,3,5,2,4,6} since OCL
knows nothing about the ordering criterion used to create each Sequence.
Sequence{1,3,5}->appendAll(Sequence{2,4,6}) doesn't surprise me in the
same way.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=479042 raised so that I
might look at this next time I review the library.
Regards
Ed Willink
On 05/10/2015 13:45, Spencer Crosswy wrote:
> I'm seeing unexpected behavior for the 'union' operation on
> Collections and UniqueCollections. A union of Collections always
> returns a Bag; a union of UniqueCollections always returns a Set.
>
> This behavior does align with the Eclipse OCL 6.0 spec (and earlier
> versions), but it does not align with the OMG OCL 2.4 spec that the
> Eclipse OCL 6.0 spec claims to implement. (OMG OCL 2.4 has distinct
> union operations for each collection - e.g. a union of Sequences
> returns a Sequence.)
>
> Is this intentional?
>
> I'm using Eclipse 4.5.0 (Mars) w/ OCL 6.0.0.
|
|
|
Re: Collection and UniqueCollection Union [message #1710252 is a reply to message #1710239] |
Mon, 05 October 2015 14:14 |
Spencer Crosswy Messages: 2 Registered: October 2015 |
Junior Member |
|
|
Thanks for the reply.
Does OCL-2.4.oclstdlib have a Sequence::union? How would I go about "downgrading" to that version? I recently updated to Mars w/ Eclipse OCL 6.0.0 for improved OCL debugging.
Side question (I can open a new topic if necessary): Do you/the project have these OCL 2.4 specification ambiguities documented anywhere? We would like to use OCL 2.4 for specification, so information like that could help us avoid unintentional ambiguities.
Thanks,
Spencer
Edit 10/5/15: added question about downgrading to OCL-2.4.stdlib
[Updated on: Mon, 05 October 2015 14:23] Report message to a moderator
|
|
|
|
Powered by
FUDForum. Page generated in 0.02782 seconds