isInterface = nil when copying a Moose model

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

isInterface = nil when copying a Moose model

Gustavo Santos
Hi everybody,

I'm currently trying to programatically copy a Moose model

What happens is that only the message isInterface returns nil, when the original Moose model has this information. All the other "is*" messages return something or false. I have no problem copying other information from the model whatsoever.

Looking at the code, this variable is directly set on FAMIXClass>>#isInterface: and the other ones use the FAMIXNamedEntity>>modifierSet:for: message (lazy attribution I guess)

So, why this specific information is not set? Can we change this?

Cheers,
--
Gustavo Santos

_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: isInterface = nil when copying a Moose model

Andre Hora



On Tue, Feb 25, 2014 at 8:33 PM, Gustavo Santos <[hidden email]> wrote:
Hi everybody,

I'm currently trying to programatically copy a Moose model
Which model, Java or Smalltalk? 

What happens is that only the message isInterface returns nil, when the original Moose model has this information. All the other "is*" messages return something or false. I have no problem copying other information from the model whatsoever.
In a Smalltalk model #isInterface returns false, which is ok.
I don't know how you obtain nil because the default is false (see FAMIXClass>>isInterface). OK, the instance variable is nil, so maybe you are in a subclass of FAMIXClass accessing this instance variable. In this case you should call the *getter method* #isInterface to get false instead of nil.

Looking at the code, this variable is directly set on FAMIXClass>>#isInterface: and the other ones use the FAMIXNamedEntity>>modifierSet:for: message (lazy attribution I guess)
No, this is not lazy attribution; modifiers is only a Set (see the method FAMIXNamedEntity>>initialize) which is used in order to avoid create instance variables.
isInterface is an instance variable, so it does not need to use the modifiers.

So, why this specific information is not set? Can we change this?
I don't think it is needed, or maybe I lost something in the lines :)

Cheers,
--
Gustavo Santos

_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev




--
Andre Ho

_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: isInterface = nil when copying a Moose model

Gustavo Santos
Hi Andre,

On Tue, Feb 25, 2014 at 10:05 PM, Andre Hora <[hidden email]> wrote:



On Tue, Feb 25, 2014 at 8:33 PM, Gustavo Santos <[hidden email]> wrote:
Hi everybody,

I'm currently trying to programatically copy a Moose model
Which model, Java or Smalltalk? 
It's a Smalltalk model

What happens is that only the message isInterface returns nil, when the original Moose model has this information. All the other "is*" messages return something or false. I have no problem copying other information from the model whatsoever.
In a Smalltalk model #isInterface returns false, which is ok.
I don't know how you obtain nil because the default is false (see FAMIXClass>>isInterface). OK, the instance variable is nil, so maybe you are in a subclass of FAMIXClass accessing this instance variable. In this case you should call the *getter method* #isInterface to get false instead of nil.
Yes. The thing is that I'm copying the state of the entity, so I don't have to write a lot of set's and get's. Probably this method is never called because, in the properties, isInterface is still nil. But why this case only?

Looking at the code, this variable is directly set on FAMIXClass>>#isInterface: and the other ones use the FAMIXNamedEntity>>modifierSet:for: message (lazy attribution I guess)
No, this is not lazy attribution; modifiers is only a Set (see the method FAMIXNamedEntity>>initialize) which is used in order to avoid create instance variables.
isInterface is an instance variable, so it does not need to use the modifiers.

So, why this specific information is not set? Can we change this?
I don't think it is needed, or maybe I lost something in the lines :)
For now, I'm saving a temporary variable the result of the getter call for each FAMIXClass, and then setting this information after the state and attributes are set.

Cheers,
--
Gustavo Santos

_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev




--
Andre Ho

_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev


--
Gustavo Santos

_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: isInterface = nil when copying a Moose model

Gustavo Santos
When I was copying some entity, I do not perform get so, in the state of this entity, the value of isInterface was still nil.

I added the initialize message in FAMIXClass only to set the value of its instance variable (isInterface) to a default value. It works now.

Thanks Andre for the feedback

On Wed, Feb 26, 2014 at 10:49 AM, Gustavo Santos <[hidden email]> wrote:
Hi Andre,

On Tue, Feb 25, 2014 at 10:05 PM, Andre Hora <[hidden email]> wrote:



On Tue, Feb 25, 2014 at 8:33 PM, Gustavo Santos <[hidden email]> wrote:
Hi everybody,

I'm currently trying to programatically copy a Moose model
Which model, Java or Smalltalk? 
It's a Smalltalk model

What happens is that only the message isInterface returns nil, when the original Moose model has this information. All the other "is*" messages return something or false. I have no problem copying other information from the model whatsoever.
In a Smalltalk model #isInterface returns false, which is ok.
I don't know how you obtain nil because the default is false (see FAMIXClass>>isInterface). OK, the instance variable is nil, so maybe you are in a subclass of FAMIXClass accessing this instance variable. In this case you should call the *getter method* #isInterface to get false instead of nil.
Yes. The thing is that I'm copying the state of the entity, so I don't have to write a lot of set's and get's. Probably this method is never called because, in the properties, isInterface is still nil. But why this case only?

Looking at the code, this variable is directly set on FAMIXClass>>#isInterface: and the other ones use the FAMIXNamedEntity>>modifierSet:for: message (lazy attribution I guess)
No, this is not lazy attribution; modifiers is only a Set (see the method FAMIXNamedEntity>>initialize) which is used in order to avoid create instance variables.
isInterface is an instance variable, so it does not need to use the modifiers.

So, why this specific information is not set? Can we change this?
I don't think it is needed, or maybe I lost something in the lines :)
For now, I'm saving a temporary variable the result of the getter call for each FAMIXClass, and then setting this information after the state and attributes are set.

Cheers,
--
Gustavo Santos

_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev




--
Andre Ho

_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev


--
Gustavo Santos

--
Gustavo Santos

_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev