[Cuis-dev] Do classes know what package they come from ?

Nicola Mingotti nmingotti at gmail.com
Mon Aug 9 07:06:20 PDT 2021


Thank you Gerald,

I did the digging, I see that `MyClass package` works "top down",
from the PackageList down. Not bottom up.

It is not an issue for my use case. I am not going to change it.

I just thought the Class system worked as tree structure so, doing
something like 'MyClass father father` would bring me up to the package 
level.
I see my supposition was wrong ;)

bye
Nicola





On 8/9/21 3:16 PM, Gerald Klix wrote:
> I am inclined to say "no' here ;-}
>
> The package of a class is determined by its category,
> to be precise the packages now which classes they
> are responsible for.
>
> Please see Object class>>#package and
> follow the chain of implementers.
> You will end at CodePackage>>#includesClass:
>
> It is possible to subclass CodePackage for
> your package and do something entirely different
> here, up to messing things up beyond repair.
>
> For your purpose `MySpiffyClass package fullFileName`
> should be sufficient.
>
>
> HTH,
>
> Gerald
>
>
>
> On 8/9/21 2:33 PM, Nicola Mingotti via Cuis-dev wrote:
>> Hi again,
>>
>> Problem. I have made my own package, classes, methods.
>> Ok, all is ready to start the real work. But I need to do
>> some cleaning and put data files in a reasonably safe directory
>> Example: some JSON data file needed by my methods.
>>
>> The ideal for me would be to put the data files in the same directory
>> containing the FooBar.pck.st file, or a sub-directory of it.
>>
>> Now, it would be all easy if i could say
>> ----
>> FooBar getMyPackageDirectory.
>> ----
>>
>> Up to now i found that
>> -----------------
>> ou1 _ CodePackageList new.   "# here I can find the loaded package 
>> list."
>>
>> Then I could iterate over CodePackage list in 'CodePackageList new 
>> packages' and check
>> the first one containing class 'FooBar'.
>>
>> What I ask you is this. Can I go in the inverse way? Does
>> a Class know who is its ClassCatergory ? Does a ClassCategory
>> know who is its package ?
>>
>>
>> bye
>> Nicola
>>
>>
>>



More information about the Cuis-dev mailing list