Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

, (comma) should not be implemented in the FM*MultivalueLink classes #1079

Closed
seandenigris opened this issue Aug 3, 2015 · 6 comments
Closed
Milestone

Comments

@seandenigris
Copy link
Contributor

Originally reported on Google Code with 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

Reported by v.blondeau92 on 2014-07-02 15:59:44

@seandenigris
Copy link
Contributor Author

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..."?

Reported by tudor@tudorgirba.com on 2014-07-23 20:54:46

@seandenigris
Copy link
Contributor Author

What kind of semantics do we expect when owner and opposite are not the same?

Reported by stephan@stack.nl on 2014-07-23 21:23:08

@seandenigris
Copy link
Contributor Author

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? :)


Reported by v.blondeau92 on 2014-07-23 21:53:50

@seandenigris
Copy link
Contributor Author

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?

Reported by tudor@tudorgirba.com on 2014-07-24 05:13:04

@seandenigris
Copy link
Contributor Author

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

Reported by v.blondeau92 on 2014-07-24 08:20:19

@SergeStinckwich SergeStinckwich added this to the Moose 6.0 milestone May 9, 2016
@SergeStinckwich
Copy link
Member

This bug is fixed in last version of Moose 6.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants