Hi Jannik,
Thanks for looking into this.
There is a problem with this implementation: it breaks the contract of basic attributes in
Moose. MooseNamedEntity>>parentPackage has as opposite
FAMIXPackage>>childNamedEntities. This means that the contract is that if
parentPackage is not nil then the entity is to be found in the childNamedEntities
collection.
In this case, the reason for parentPackage is that you want to use it as a unified API for
querying the parent package scope. Chef already provides this API intention in the
packageScope. So, we should move the computation from parentPackage in packageScope, and
then have queries depend on packageScope.
Cheers,
Doru
On 4 May 2011, at 09:14, Laval Jannik wrote:
Hi,
I changed the behavior of FAMIXMethod>>parentPackage.
In fact, when a method is in the same package than its class, its parentPackage should be
nil.
So, to not break the behavior, I changed the accessor like this:
===
parentPackage
^ parentPackage ifNil:[ self belongsTo parentPackage]
===
But this breaks during importation of MSE files (it breaks some tests of smalldude and
eyesee).
The problem is due to the class that is not already defined during the importation.
So I changed the source code like that. I am not convince of the efficiency of this code.
Have you another idea ?
===
parentPackage
^ parentPackage ifNil:[
|cl|
cl := self belongsTo.
cl isNil
ifTrue:[nil]
ifFalse:[cl parentPackage]
]
===
---
Jannik Laval
_______________________________________________
Moose-dev mailing list
Moose-dev(a)iam.unibe.ch
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
--
www.tudorgirba.com
"Yesterday is a fact.
Tomorrow is a possibility.
Today is a challenge."