Status: New Owner: ---- Labels: Type-Defect Priority-Medium
New issue 1079 by v.blonde...@gmail.com: , (comma) should not be implemented in the FM*MultivalueLink classes http://code.google.com/p/moose-technology/issues/detail?id=1079
Describe the problem: what do you get? what do you expect?
When you send the message "," to a FM*MultivalueLink, you expect to have a copy of your collection with no impact on the old one. But it's not the case with the FM*MultivalueLink instances which are keeping a link to the old collection...
I propose to implement "," in FM*MultivalueLink by: self shouldNotImplement
What do you think ?
How to reproduce the problem: step by step if necessary
Execute: |class| class:=FAMIXClass new addAttribute:(FAMIXAttribute new);yourself. class methods
Here "class methods" is empty
class methods , class attributes. class methods
Here "class methods" is not empty !
Additional information: platform, context which may impact the problem
W7 - Moose latest
Please fill in the labels with the following information: * Type-Enhancement * Component-Fame
Comment #1 on issue 1079 by tu...@tudorgirba.com: , (comma) should not be implemented in the FM*MultivalueLink classes http://code.google.com/p/moose-technology/issues/detail?id=1079
I guess it's just late, but I cannot get my head around why the original collection gets modified :).
FMMultivalue is actually copying itself:
f := FMMultivalueLink new. f copy == f "==> false" f copy = f "==> false"
Why do you say that " FM*MultivalueLink instances which are keeping a link to the old collection..."?
Comment #2 on issue 1079 by step...@stack.nl: , (comma) should not be implemented in the FM*MultivalueLink classes http://code.google.com/p/moose-technology/issues/detail?id=1079
What kind of semantics do we expect when owner and opposite are not the same?
Comment #3 on issue 1079 by v.blonde...@gmail.com: , (comma) should not be implemented in the FM*MultivalueLink classes http://code.google.com/p/moose-technology/issues/detail?id=1079
Of course, when you copy a FMMultivalueLink you get a copy of the FMMultivalueLink. But don't forget that, by nature, the FMMultivalueLink is liked to an method accessor to update itself.
In moose you don't do FMMultivalueLink new. But "FMMultivalueLink on: aFamixClass opposite: #parentType:" for instance.
So "," do a copy of the receiver and add to this copy each element of the argument. But the add method in FMMultivalueLink is updating aFamixClass parentType (if we take the example). But parentType is an other FMMultivalueLink that is updating the "attribute" value of aFamixClass. And this value is the old FMMultivalue link (the old collection) and not the new one you just copied ! To summarize, by doing "," : - you just add nothing to your new collection - and you add something to a collection that you don't wanted to change... That is why I propose to remove it.
And it's not late ! For the next using this method, it will be useful !
Does your head feel better? :)
Comment #4 on issue 1079 by tu...@tudorgirba.com: , (comma) should not be implemented in the FM*MultivalueLink classes http://code.google.com/p/moose-technology/issues/detail?id=1079
Ok. It seems that sleeping does make wonders :).
I would suggest to have it implemented like this:
, aCollection ^ self asOrderedCollection , aCollection
What do you think?
Comment #5 on issue 1079 by v.blonde...@gmail.com: , (comma) should not be implemented in the FM*MultivalueLink classes http://code.google.com/p/moose-technology/issues/detail?id=1079
That is good for me.
Commited in Name: Fame-Core-VincentBlondeau.24 Author: VincentBlondeau Time: 24 July 2014, 10:19:43.303281 am UUID: fffa0632-3b49-2f4e-b3e0-b682bc721a65