Pragma-based properties not updated with MooseModel resetMeta

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

Pragma-based properties not updated with MooseModel resetMeta

Usman Bhatti
I create a new property in a MooseEntity.

isFlag
<MSEProperty: #isFlag type: #Boolean>
<MSEComment: 'An exemplary flag'>
^ isFlag

I do MooseModel resetMeta.

I export the model with the entity containing the flag to an MSE.

isFlag property is absent in the mse file.

Is this a known bug/feature or do I need to update something?

Usman


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

Re: Pragma-based properties not updated with MooseModel resetMeta

Andre Hora
It worked for me Usman, no problem.
As a test do:

isFlag
<MSEProperty: #isFlag type: #Boolean>
<MSEComment: 'my flag'>
^ true

Then, MooseModel resetMeta.
It will export ok:
=======
(FAMIX.Method (id: 147)
(name 'clearReplacements')
(cyclomaticComplexity 1)
(isFlag true)
(modifiers 'public')
(numberOfComments true)
(numberOfConditionals 0)
=======

Most probably your #isFlag property is nil, then it is not exported in the MSE file



On Thu, Nov 21, 2013 at 7:01 PM, Usman Bhatti <[hidden email]> wrote:
I create a new property in a MooseEntity.

isFlag
<MSEProperty: #isFlag type: #Boolean>
<MSEComment: 'An exemplary flag'>
^ isFlag

I do MooseModel resetMeta.

I export the model with the entity containing the flag to an MSE.

isFlag property is absent in the mse file.

Is this a known bug/feature or do I need to update something?

Usman


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




--
Andre Hora

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

Re: Pragma-based properties not updated with MooseModel resetMeta

Usman Bhatti
I believe there is some sort of cache that is maintained somewhere because it works for me in the new image but if a property is added after exporting a model to a MSE file, it doesn't work.
Tx André for looking into it.

Usman



On Thu, Nov 21, 2013 at 8:58 PM, Andre Hora <[hidden email]> wrote:
It worked for me Usman, no problem.
As a test do:

isFlag
<MSEProperty: #isFlag type: #Boolean>
<MSEComment: 'my flag'>
^ true

Then, MooseModel resetMeta.
It will export ok:
=======
(FAMIX.Method (id: 147)
(name 'clearReplacements')
(cyclomaticComplexity 1)
(isFlag true)
(modifiers 'public')
(numberOfComments true)
(numberOfConditionals 0)
=======

Most probably your #isFlag property is nil, then it is not exported in the MSE file



On Thu, Nov 21, 2013 at 7:01 PM, Usman Bhatti <[hidden email]> wrote:
I create a new property in a MooseEntity.

isFlag
<MSEProperty: #isFlag type: #Boolean>
<MSEComment: 'An exemplary flag'>
^ isFlag

I do MooseModel resetMeta.

I export the model with the entity containing the flag to an MSE.

isFlag property is absent in the mse file.

Is this a known bug/feature or do I need to update something?

Usman


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




--
Andre Hora

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



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

Re: Pragma-based properties not updated with MooseModel resetMeta

Tudor Girba-2
In reply to this post by Andre Hora
If you want to see the state of the meta-descriptions, look in the Meta Browser. That will tell you whether the property is defined or not.

Cheers,
Doru


On Thu, Nov 21, 2013 at 8:58 PM, Andre Hora <[hidden email]> wrote:
It worked for me Usman, no problem.
As a test do:

isFlag
<MSEProperty: #isFlag type: #Boolean>
<MSEComment: 'my flag'>
^ true

Then, MooseModel resetMeta.
It will export ok:
=======
(FAMIX.Method (id: 147)
(name 'clearReplacements')
(cyclomaticComplexity 1)
(isFlag true)
(modifiers 'public')
(numberOfComments true)
(numberOfConditionals 0)
=======

Most probably your #isFlag property is nil, then it is not exported in the MSE file



On Thu, Nov 21, 2013 at 7:01 PM, Usman Bhatti <[hidden email]> wrote:
I create a new property in a MooseEntity.

isFlag
<MSEProperty: #isFlag type: #Boolean>
<MSEComment: 'An exemplary flag'>
^ isFlag

I do MooseModel resetMeta.

I export the model with the entity containing the flag to an MSE.

isFlag property is absent in the mse file.

Is this a known bug/feature or do I need to update something?

Usman


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




--
Andre Hora

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




--

"Every thing has its own flow"

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

Re: Pragma-based properties not updated with MooseModel resetMeta

Usman Bhatti
In reply to this post by Usman Bhatti
I tried to reproduce it through various ways but couldn't, may be it was my image. I'll try to be more vigilant next time. In the meantime, I tried to reproduce the anomaly with this script, may be we can create a test (with a dummy class?)?

|model propertyName|
propertyName := 'isFlag'.
FAMIXMethod addInstVarNamed: propertyName.
FAMIXMethod compile: propertyName,
'<MSEProperty: #', propertyName,' type: #Boolean>
<MSEComment: ''A test flag''>
^', propertyName.

MooseModel resetMeta.
model := MooseModel new.
MoosePharoImporterTask new
importerClass: SmalltalkImporter;
doNotRunCandidateOperator; 
importingContext: (MooseImportingContext new importClass; importMethod; importPackage; yourself);
model: model;
addFromPackageNamed: #'Moose-TestResources-LAN';
run;
yourself.
model allMethods do: [ :each | each instVarNamed: propertyName put: true ].


model exportToMSEStream:(StandardFileStream forceNewFileNamed: 'aTestFile.mse').
MooseModel new importFromMSEStream:(StandardFileStream readOnlyFileNamed: 'aTestFile.mse') "should give an error because the propertyName: selector is absent"


On Thu, Nov 21, 2013 at 9:31 PM, Usman Bhatti <[hidden email]> wrote:
I believe there is some sort of cache that is maintained somewhere because it works for me in the new image but if a property is added after exporting a model to a MSE file, it doesn't work.
Tx André for looking into it.

Usman



On Thu, Nov 21, 2013 at 8:58 PM, Andre Hora <[hidden email]> wrote:
It worked for me Usman, no problem.
As a test do:

isFlag
<MSEProperty: #isFlag type: #Boolean>
<MSEComment: 'my flag'>
^ true

Then, MooseModel resetMeta.
It will export ok:
=======
(FAMIX.Method (id: 147)
(name 'clearReplacements')
(cyclomaticComplexity 1)
(isFlag true)
(modifiers 'public')
(numberOfComments true)
(numberOfConditionals 0)
=======

Most probably your #isFlag property is nil, then it is not exported in the MSE file



On Thu, Nov 21, 2013 at 7:01 PM, Usman Bhatti <[hidden email]> wrote:
I create a new property in a MooseEntity.

isFlag
<MSEProperty: #isFlag type: #Boolean>
<MSEComment: 'An exemplary flag'>
^ isFlag

I do MooseModel resetMeta.

I export the model with the entity containing the flag to an MSE.

isFlag property is absent in the mse file.

Is this a known bug/feature or do I need to update something?

Usman


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




--
Andre Hora

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




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

Re: Pragma-based properties not updated with MooseModel resetMeta

Tudor Girba-2
Hi,

You get the error because you do not have a setter to set the value of the isFlag property when importing the model.

How is this an indication of a problem?

Doru



On Thu, Nov 21, 2013 at 10:48 PM, Usman Bhatti <[hidden email]> wrote:
I tried to reproduce it through various ways but couldn't, may be it was my image. I'll try to be more vigilant next time. In the meantime, I tried to reproduce the anomaly with this script, may be we can create a test (with a dummy class?)?

|model propertyName|
propertyName := 'isFlag'.
FAMIXMethod addInstVarNamed: propertyName.
FAMIXMethod compile: propertyName,
'<MSEProperty: #', propertyName,' type: #Boolean>
<MSEComment: ''A test flag''>
^', propertyName.

MooseModel resetMeta.
model := MooseModel new.
MoosePharoImporterTask new
importerClass: SmalltalkImporter;
doNotRunCandidateOperator; 
importingContext: (MooseImportingContext new importClass; importMethod; importPackage; yourself);
model: model;
addFromPackageNamed: #'Moose-TestResources-LAN';
run;
yourself.
model allMethods do: [ :each | each instVarNamed: propertyName put: true ].


model exportToMSEStream:(StandardFileStream forceNewFileNamed: 'aTestFile.mse').
MooseModel new importFromMSEStream:(StandardFileStream readOnlyFileNamed: 'aTestFile.mse') "should give an error because the propertyName: selector is absent"


On Thu, Nov 21, 2013 at 9:31 PM, Usman Bhatti <[hidden email]> wrote:
I believe there is some sort of cache that is maintained somewhere because it works for me in the new image but if a property is added after exporting a model to a MSE file, it doesn't work.
Tx André for looking into it.

Usman



On Thu, Nov 21, 2013 at 8:58 PM, Andre Hora <[hidden email]> wrote:
It worked for me Usman, no problem.
As a test do:

isFlag
<MSEProperty: #isFlag type: #Boolean>
<MSEComment: 'my flag'>
^ true

Then, MooseModel resetMeta.
It will export ok:
=======
(FAMIX.Method (id: 147)
(name 'clearReplacements')
(cyclomaticComplexity 1)
(isFlag true)
(modifiers 'public')
(numberOfComments true)
(numberOfConditionals 0)
=======

Most probably your #isFlag property is nil, then it is not exported in the MSE file



On Thu, Nov 21, 2013 at 7:01 PM, Usman Bhatti <[hidden email]> wrote:
I create a new property in a MooseEntity.

isFlag
<MSEProperty: #isFlag type: #Boolean>
<MSEComment: 'An exemplary flag'>
^ isFlag

I do MooseModel resetMeta.

I export the model with the entity containing the flag to an MSE.

isFlag property is absent in the mse file.

Is this a known bug/feature or do I need to update something?

Usman


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




--
Andre Hora

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




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




--

"Every thing has its own flow"

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

Re: Pragma-based properties not updated with MooseModel resetMeta

Uko2

On 22 Nov 2013, at 08:24, Tudor Girba <[hidden email]> wrote:

Hi,

You get the error because you do not have a setter to set the value of the isFlag property when importing the model.

Why do you need a setter? We can you reflection.

Uko


How is this an indication of a problem?

Doru



On Thu, Nov 21, 2013 at 10:48 PM, Usman Bhatti <[hidden email]> wrote:
I tried to reproduce it through various ways but couldn't, may be it was my image. I'll try to be more vigilant next time. In the meantime, I tried to reproduce the anomaly with this script, may be we can create a test (with a dummy class?)?

|model propertyName|
propertyName := 'isFlag'.
FAMIXMethod addInstVarNamed: propertyName.
FAMIXMethod compile: propertyName,
'<MSEProperty: #', propertyName,' type: #Boolean>
<MSEComment: ''A test flag''>
^', propertyName.

MooseModel resetMeta.
model := MooseModel new.
MoosePharoImporterTask new
importerClass: SmalltalkImporter;
doNotRunCandidateOperator; 
importingContext: (MooseImportingContext new importClass; importMethod; importPackage; yourself);
model: model;
addFromPackageNamed: #'Moose-TestResources-LAN';
run;
yourself.
model allMethods do: [ :each | each instVarNamed: propertyName put: true ].


model exportToMSEStream:(StandardFileStream forceNewFileNamed: 'aTestFile.mse').
MooseModel new importFromMSEStream:(StandardFileStream readOnlyFileNamed: 'aTestFile.mse') "should give an error because the propertyName: selector is absent"


On Thu, Nov 21, 2013 at 9:31 PM, Usman Bhatti <[hidden email]> wrote:
I believe there is some sort of cache that is maintained somewhere because it works for me in the new image but if a property is added after exporting a model to a MSE file, it doesn't work.
Tx André for looking into it.

Usman



On Thu, Nov 21, 2013 at 8:58 PM, Andre Hora <[hidden email]> wrote:
It worked for me Usman, no problem.
As a test do:

isFlag
<MSEProperty: #isFlag type: #Boolean>
<MSEComment: 'my flag'>
^ true

Then, MooseModel resetMeta.
It will export ok:
=======
(FAMIX.Method (id: 147)
(name 'clearReplacements')
(cyclomaticComplexity 1)
(isFlag true)
(modifiers 'public')
(numberOfComments true)
(numberOfConditionals 0)
=======

Most probably your #isFlag property is nil, then it is not exported in the MSE file



On Thu, Nov 21, 2013 at 7:01 PM, Usman Bhatti <[hidden email]> wrote:
I create a new property in a MooseEntity.

isFlag
<MSEProperty: #isFlag type: #Boolean>
<MSEComment: 'An exemplary flag'>
^ isFlag

I do MooseModel resetMeta.

I export the model with the entity containing the flag to an MSE.

isFlag property is absent in the mse file.

Is this a known bug/feature or do I need to update something?

Usman


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




--
Andre Hora

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




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




--

"Every thing has its own flow"
_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev


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

Re: Pragma-based properties not updated with MooseModel resetMeta

Tudor Girba-2
The setter is the default behavior. It can be possible to use reflection, but you do not always have an instance variable for a property. Every MooseEntity has an EntityState that offers a dictionary. This dictionary can be extended by meta-model extensions, and you can end up with properties that are actually stored in this dictionary.

For the future we should rework this part and use the slots available in Pharo 3 instead of the dictionary. For that we need to have the slots be extensible by external packages, which is not yet happening. This will simplify the Moose code.

Cheers,
Doru


On Fri, Nov 22, 2013 at 9:10 AM, Yuriy Tymchuk <[hidden email]> wrote:

On 22 Nov 2013, at 08:24, Tudor Girba <[hidden email]> wrote:

Hi,

You get the error because you do not have a setter to set the value of the isFlag property when importing the model.

Why do you need a setter? We can you reflection.

Uko


How is this an indication of a problem?

Doru



On Thu, Nov 21, 2013 at 10:48 PM, Usman Bhatti <[hidden email]> wrote:
I tried to reproduce it through various ways but couldn't, may be it was my image. I'll try to be more vigilant next time. In the meantime, I tried to reproduce the anomaly with this script, may be we can create a test (with a dummy class?)?

|model propertyName|
propertyName := 'isFlag'.
FAMIXMethod addInstVarNamed: propertyName.
FAMIXMethod compile: propertyName,
'<MSEProperty: #', propertyName,' type: #Boolean>
<MSEComment: ''A test flag''>
^', propertyName.

MooseModel resetMeta.
model := MooseModel new.
MoosePharoImporterTask new
importerClass: SmalltalkImporter;
doNotRunCandidateOperator; 
importingContext: (MooseImportingContext new importClass; importMethod; importPackage; yourself);
model: model;
addFromPackageNamed: #'Moose-TestResources-LAN';
run;
yourself.
model allMethods do: [ :each | each instVarNamed: propertyName put: true ].


model exportToMSEStream:(StandardFileStream forceNewFileNamed: 'aTestFile.mse').
MooseModel new importFromMSEStream:(StandardFileStream readOnlyFileNamed: 'aTestFile.mse') "should give an error because the propertyName: selector is absent"


On Thu, Nov 21, 2013 at 9:31 PM, Usman Bhatti <[hidden email]> wrote:
I believe there is some sort of cache that is maintained somewhere because it works for me in the new image but if a property is added after exporting a model to a MSE file, it doesn't work.
Tx André for looking into it.

Usman



On Thu, Nov 21, 2013 at 8:58 PM, Andre Hora <[hidden email]> wrote:
It worked for me Usman, no problem.
As a test do:

isFlag
<MSEProperty: #isFlag type: #Boolean>
<MSEComment: 'my flag'>
^ true

Then, MooseModel resetMeta.
It will export ok:
=======
(FAMIX.Method (id: 147)
(name 'clearReplacements')
(cyclomaticComplexity 1)
(isFlag true)
(modifiers 'public')
(numberOfComments true)
(numberOfConditionals 0)
=======

Most probably your #isFlag property is nil, then it is not exported in the MSE file



On Thu, Nov 21, 2013 at 7:01 PM, Usman Bhatti <[hidden email]> wrote:
I create a new property in a MooseEntity.

isFlag
<MSEProperty: #isFlag type: #Boolean>
<MSEComment: 'An exemplary flag'>
^ isFlag

I do MooseModel resetMeta.

I export the model with the entity containing the flag to an MSE.

isFlag property is absent in the mse file.

Is this a known bug/feature or do I need to update something?

Usman


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




--
Andre Hora

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




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




--

"Every thing has its own flow"
_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev


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




--

"Every thing has its own flow"

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

Re: Pragma-based properties not updated with MooseModel resetMeta

Usman Bhatti
In reply to this post by Tudor Girba-2



On Fri, Nov 22, 2013 at 8:24 AM, Tudor Girba <[hidden email]> wrote:
Hi,

You get the error because you do not have a setter to set the value of the isFlag property when importing the model.

How is this an indication of a problem?

I explicitly omitted the setter of the property so that the import of the property fails to show that the property is exported but cannot be imported. If the import doesn't fail then the property is not exported. I think this test can be handy in Moose.


 

Doru



On Thu, Nov 21, 2013 at 10:48 PM, Usman Bhatti <[hidden email]> wrote:
I tried to reproduce it through various ways but couldn't, may be it was my image. I'll try to be more vigilant next time. In the meantime, I tried to reproduce the anomaly with this script, may be we can create a test (with a dummy class?)?

|model propertyName|
propertyName := 'isFlag'.
FAMIXMethod addInstVarNamed: propertyName.
FAMIXMethod compile: propertyName,
'<MSEProperty: #', propertyName,' type: #Boolean>
<MSEComment: ''A test flag''>
^', propertyName.

MooseModel resetMeta.
model := MooseModel new.
MoosePharoImporterTask new
importerClass: SmalltalkImporter;
doNotRunCandidateOperator; 
importingContext: (MooseImportingContext new importClass; importMethod; importPackage; yourself);
model: model;
addFromPackageNamed: #'Moose-TestResources-LAN';
run;
yourself.
model allMethods do: [ :each | each instVarNamed: propertyName put: true ].


model exportToMSEStream:(StandardFileStream forceNewFileNamed: 'aTestFile.mse').
MooseModel new importFromMSEStream:(StandardFileStream readOnlyFileNamed: 'aTestFile.mse') "should give an error because the propertyName: selector is absent"


On Thu, Nov 21, 2013 at 9:31 PM, Usman Bhatti <[hidden email]> wrote:
I believe there is some sort of cache that is maintained somewhere because it works for me in the new image but if a property is added after exporting a model to a MSE file, it doesn't work.
Tx André for looking into it.

Usman



On Thu, Nov 21, 2013 at 8:58 PM, Andre Hora <[hidden email]> wrote:
It worked for me Usman, no problem.
As a test do:

isFlag
<MSEProperty: #isFlag type: #Boolean>
<MSEComment: 'my flag'>
^ true

Then, MooseModel resetMeta.
It will export ok:
=======
(FAMIX.Method (id: 147)
(name 'clearReplacements')
(cyclomaticComplexity 1)
(isFlag true)
(modifiers 'public')
(numberOfComments true)
(numberOfConditionals 0)
=======

Most probably your #isFlag property is nil, then it is not exported in the MSE file



On Thu, Nov 21, 2013 at 7:01 PM, Usman Bhatti <[hidden email]> wrote:
I create a new property in a MooseEntity.

isFlag
<MSEProperty: #isFlag type: #Boolean>
<MSEComment: 'An exemplary flag'>
^ isFlag

I do MooseModel resetMeta.

I export the model with the entity containing the flag to an MSE.

isFlag property is absent in the mse file.

Is this a known bug/feature or do I need to update something?

Usman


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




--
Andre Hora

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




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




--

"Every thing has its own flow"

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



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

Re: Pragma-based properties not updated with MooseModel resetMeta

Uko2
In reply to this post by Tudor Girba-2

On 22 Nov 2013, at 09:59, Tudor Girba <[hidden email]> wrote:

The setter is the default behavior. It can be possible to use reflection, but you do not always have an instance variable for a property. Every MooseEntity has an EntityState that offers a dictionary. This dictionary can be extended by meta-model extensions, and you can end up with properties that are actually stored in this dictionary.

Buy the way, do you think we can use Slots to replace MultivalueLinks?


For the future we should rework this part and use the slots available in Pharo 3 instead of the dictionary. For that we need to have the slots be extensible by external packages, which is not yet happening. This will simplify the Moose code.

Cheers,
Doru


On Fri, Nov 22, 2013 at 9:10 AM, Yuriy Tymchuk <[hidden email]> wrote:

On 22 Nov 2013, at 08:24, Tudor Girba <[hidden email]> wrote:

Hi,

You get the error because you do not have a setter to set the value of the isFlag property when importing the model.

Why do you need a setter? We can you reflection.

Uko


How is this an indication of a problem?

Doru



On Thu, Nov 21, 2013 at 10:48 PM, Usman Bhatti <[hidden email]> wrote:
I tried to reproduce it through various ways but couldn't, may be it was my image. I'll try to be more vigilant next time. In the meantime, I tried to reproduce the anomaly with this script, may be we can create a test (with a dummy class?)?

|model propertyName|
propertyName := 'isFlag'.
FAMIXMethod addInstVarNamed: propertyName.
FAMIXMethod compile: propertyName,
'<MSEProperty: #', propertyName,' type: #Boolean>
<MSEComment: ''A test flag''>
^', propertyName.

MooseModel resetMeta.
model := MooseModel new.
MoosePharoImporterTask new
importerClass: SmalltalkImporter;
doNotRunCandidateOperator; 
importingContext: (MooseImportingContext new importClass; importMethod; importPackage; yourself);
model: model;
addFromPackageNamed: #'Moose-TestResources-LAN';
run;
yourself.
model allMethods do: [ :each | each instVarNamed: propertyName put: true ].


model exportToMSEStream:(StandardFileStream forceNewFileNamed: 'aTestFile.mse').
MooseModel new importFromMSEStream:(StandardFileStream readOnlyFileNamed: 'aTestFile.mse') "should give an error because the propertyName: selector is absent"


On Thu, Nov 21, 2013 at 9:31 PM, Usman Bhatti <[hidden email]> wrote:
I believe there is some sort of cache that is maintained somewhere because it works for me in the new image but if a property is added after exporting a model to a MSE file, it doesn't work.
Tx André for looking into it.

Usman



On Thu, Nov 21, 2013 at 8:58 PM, Andre Hora <[hidden email]> wrote:
It worked for me Usman, no problem.
As a test do:

isFlag
<MSEProperty: #isFlag type: #Boolean>
<MSEComment: 'my flag'>
^ true

Then, MooseModel resetMeta.
It will export ok:
=======
(FAMIX.Method (id: 147)
(name 'clearReplacements')
(cyclomaticComplexity 1)
(isFlag true)
(modifiers 'public')
(numberOfComments true)
(numberOfConditionals 0)
=======

Most probably your #isFlag property is nil, then it is not exported in the MSE file



On Thu, Nov 21, 2013 at 7:01 PM, Usman Bhatti <[hidden email]> wrote:
I create a new property in a MooseEntity.

isFlag
<MSEProperty: #isFlag type: #Boolean>
<MSEComment: 'An exemplary flag'>
^ isFlag

I do MooseModel resetMeta.

I export the model with the entity containing the flag to an MSE.

isFlag property is absent in the mse file.

Is this a known bug/feature or do I need to update something?

Usman


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




--
Andre Hora

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




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




--

"Every thing has its own flow"
_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev


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




--

"Every thing has its own flow"
_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev


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

Re: Pragma-based properties not updated with MooseModel resetMeta

Tudor Girba-2
Definitely. Slots should eventually replace both EntityState from Moose and the ValueLinks from Fame. It would be great if someone could give this a try.

Cheers,
Doru


On Fri, Nov 22, 2013 at 10:12 AM, Yuriy Tymchuk <[hidden email]> wrote:

On 22 Nov 2013, at 09:59, Tudor Girba <[hidden email]> wrote:

The setter is the default behavior. It can be possible to use reflection, but you do not always have an instance variable for a property. Every MooseEntity has an EntityState that offers a dictionary. This dictionary can be extended by meta-model extensions, and you can end up with properties that are actually stored in this dictionary.

Buy the way, do you think we can use Slots to replace MultivalueLinks?


For the future we should rework this part and use the slots available in Pharo 3 instead of the dictionary. For that we need to have the slots be extensible by external packages, which is not yet happening. This will simplify the Moose code.

Cheers,
Doru


On Fri, Nov 22, 2013 at 9:10 AM, Yuriy Tymchuk <[hidden email]> wrote:

On 22 Nov 2013, at 08:24, Tudor Girba <[hidden email]> wrote:

Hi,

You get the error because you do not have a setter to set the value of the isFlag property when importing the model.

Why do you need a setter? We can you reflection.

Uko


How is this an indication of a problem?

Doru



On Thu, Nov 21, 2013 at 10:48 PM, Usman Bhatti <[hidden email]> wrote:
I tried to reproduce it through various ways but couldn't, may be it was my image. I'll try to be more vigilant next time. In the meantime, I tried to reproduce the anomaly with this script, may be we can create a test (with a dummy class?)?

|model propertyName|
propertyName := 'isFlag'.
FAMIXMethod addInstVarNamed: propertyName.
FAMIXMethod compile: propertyName,
'<MSEProperty: #', propertyName,' type: #Boolean>
<MSEComment: ''A test flag''>
^', propertyName.

MooseModel resetMeta.
model := MooseModel new.
MoosePharoImporterTask new
importerClass: SmalltalkImporter;
doNotRunCandidateOperator; 
importingContext: (MooseImportingContext new importClass; importMethod; importPackage; yourself);
model: model;
addFromPackageNamed: #'Moose-TestResources-LAN';
run;
yourself.
model allMethods do: [ :each | each instVarNamed: propertyName put: true ].


model exportToMSEStream:(StandardFileStream forceNewFileNamed: 'aTestFile.mse').
MooseModel new importFromMSEStream:(StandardFileStream readOnlyFileNamed: 'aTestFile.mse') "should give an error because the propertyName: selector is absent"


On Thu, Nov 21, 2013 at 9:31 PM, Usman Bhatti <[hidden email]> wrote:
I believe there is some sort of cache that is maintained somewhere because it works for me in the new image but if a property is added after exporting a model to a MSE file, it doesn't work.
Tx André for looking into it.

Usman



On Thu, Nov 21, 2013 at 8:58 PM, Andre Hora <[hidden email]> wrote:
It worked for me Usman, no problem.
As a test do:

isFlag
<MSEProperty: #isFlag type: #Boolean>
<MSEComment: 'my flag'>
^ true

Then, MooseModel resetMeta.
It will export ok:
=======
(FAMIX.Method (id: 147)
(name 'clearReplacements')
(cyclomaticComplexity 1)
(isFlag true)
(modifiers 'public')
(numberOfComments true)
(numberOfConditionals 0)
=======

Most probably your #isFlag property is nil, then it is not exported in the MSE file



On Thu, Nov 21, 2013 at 7:01 PM, Usman Bhatti <[hidden email]> wrote:
I create a new property in a MooseEntity.

isFlag
<MSEProperty: #isFlag type: #Boolean>
<MSEComment: 'An exemplary flag'>
^ isFlag

I do MooseModel resetMeta.

I export the model with the entity containing the flag to an MSE.

isFlag property is absent in the mse file.

Is this a known bug/feature or do I need to update something?

Usman


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




--
Andre Hora

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




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




--

"Every thing has its own flow"
_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev


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




--

"Every thing has its own flow"
_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev


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




--

"Every thing has its own flow"

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