[Pharo-project] How to query the owner package of a RPackage ?
Hi all, Since a RPackage can have sub-packages (see RPackage>>systemSubPackages) I'm wondering how to get the parent package of a package. btw: why are subPackages computed ? I mean it seems to me that a package can be considered as a composite, so why not directly associate a package with its children ? (and maybe have a two ways association between a child and a parent package). ----- RPackage>>systemSubPackages "return all RPackages matching with systemCategories of this RPackage" |tmpPackages| tmpPackages := OrderedCollection new. self systemCategories do: [:aString | (aString asSymbol = self name) ifFalse: [ |tmpPackage| "Maybe a RPackage matching the subcategory name does not yet exist in the organizer (Because packageInfo lazily register category from system). In this case, We should also lazily register a new RPackage with the right contents inside:" tmpPackage := RPackageOrganizer default packageNamed: aString asSymbol ifAbsent: [RPackageOrganizer default importFromPackageInfo: (PackageInfo named: aString)]. tmpPackages add: (tmpPackage). ]. ]. ^ tmpPackages ----- Thanks Alain
It was decided a long time ago that RPackage should not have a nested structure. Doru On Thu, Apr 5, 2012 at 11:31 AM, Alain Plantec <alain.plantec@yahoo.com> wrote:
Hi all, Since a RPackage can have sub-packages (see RPackage>>systemSubPackages) I'm wondering how to get the parent package of a package.
btw: why are subPackages computed ? I mean it seems to me that a package can be considered as a composite, so why not directly associate a package with its children ? (and maybe have a two ways association between a child and a parent package).
----- RPackage>>systemSubPackages
  "return all RPackages matching with systemCategories of this RPackage"   |tmpPackages|   tmpPackages := OrderedCollection new.   self systemCategories do: [:aString |     (aString asSymbol = self name) ifFalse: [       |tmpPackage|       "Maybe a RPackage matching the subcategory name does not yet exist in the organizer (Because packageInfo lazily register category from system). In this case, We should also lazily register a new RPackage with the right contents inside:"       tmpPackage := RPackageOrganizer default packageNamed: aString asSymbol ifAbsent: [RPackageOrganizer default importFromPackageInfo: (PackageInfo named: aString)].       tmpPackages add: (tmpPackage).       ].     ].   ^ tmpPackages -----
Thanks Alain
-- www.tudorgirba.com "Every thing has its own flow"
Yes! No subclass package. Stef
It was decided a long time ago that RPackage should not have a nested structure.
Doru
On Thu, Apr 5, 2012 at 11:31 AM, Alain Plantec <alain.plantec@yahoo.com> wrote:
Hi all, Since a RPackage can have sub-packages (see RPackage>>systemSubPackages) I'm wondering how to get the parent package of a package.
btw: why are subPackages computed ? I mean it seems to me that a package can be considered as a composite, so why not directly associate a package with its children ? (and maybe have a two ways association between a child and a parent package).
----- RPackage>>systemSubPackages
"return all RPackages matching with systemCategories of this RPackage" |tmpPackages| tmpPackages := OrderedCollection new. self systemCategories do: [:aString | (aString asSymbol = self name) ifFalse: [ |tmpPackage| "Maybe a RPackage matching the subcategory name does not yet exist in the organizer (Because packageInfo lazily register category from system). In this case, We should also lazily register a new RPackage with the right contents inside:" tmpPackage := RPackageOrganizer default packageNamed: aString asSymbol ifAbsent: [RPackageOrganizer default importFromPackageInfo: (PackageInfo named: aString)]. tmpPackages add: (tmpPackage). ]. ]. ^ tmpPackages -----
Thanks Alain
-- www.tudorgirba.com
"Every thing has its own flow"
participants (3)
-
Alain Plantec -
Stéphane Ducasse -
Tudor Girba