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 <yuriy.tymchuk(a)me.com> wrote:
On 22 Nov 2013, at 08:24, Tudor Girba <tudor(a)tudorgirba.com> 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 <usman.bhatti(a)gmail.com>wrote;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 <usman.bhatti(a)gmail.com>wrote;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 <andrehoraa(a)gmail.com>wrote;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 <usman.bhatti(a)gmail.com>wrote;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
> Moose-dev(a)iam.unibe.ch
>
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
>
>
--
Andre Hora
_______________________________________________
Moose-dev mailing list
Moose-dev(a)iam.unibe.ch
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
_______________________________________________
Moose-dev mailing list
Moose-dev(a)iam.unibe.ch
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
--
www.tudorgirba.com
"Every thing has its own flow"
_______________________________________________
Moose-dev mailing list
Moose-dev(a)iam.unibe.ch
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
_______________________________________________
Moose-dev mailing list
Moose-dev(a)iam.unibe.ch
https://www.iam.unibe.ch/mailman/listinfo/moose-dev