Finding the package of a class

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

Finding the package of a class

Sean P. DeNigris
Administrator
"PackageOrganizer default packageOfClass: FileSystemError" returns the category, whether it's a separate package or not. How do I get the mc package?

The only thing I can think of is something like:
MCWorkingCopy allInstances detect: [ :e | e packageName beginsWith: aString ]
but it seems like there should be a built-in way, and the above is naive e.g. if aString = 'Package', the condition will be true for Package and PackageTests, which is wrong...

Thanks,
Sean
Cheers,
Sean
Reply | Threaded
Open this post in threaded view
|

Re: Finding the package of a class

Igor Stasenko
On 16 June 2012 05:57, Sean P. DeNigris <[hidden email]> wrote:

> "PackageOrganizer default packageOfClass: FileSystemError" returns the
> category, whether it's a separate package or not. How do I get the mc
> package?
>
> The only thing I can think of is something like:
> MCWorkingCopy allInstances detect: [ :e | e packageName beginsWith: aString
> ]
> but it seems like there should be a built-in way, and the above is naive
> e.g. if aString = 'Package', the condition will be true for Package and
> PackageTests, which is wrong...

yeah..
i hope someday we will have something as simple as following:

Class>>package
  ^ package

Class>>packageName
  ^ self package name

etc..
Because the way how it is done today is just a dog's hut scaled to the
size of cathedral.

>
> Thanks,
> Sean
>
> --
> View this message in context: http://forum.world.st/Finding-the-package-of-a-class-tp4635070.html
> Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
>



--
Best regards,
Igor Stasenko.

Reply | Threaded
Open this post in threaded view
|

Re: Finding the package of a class

Stéphane Ducasse
In reply to this post by Sean P. DeNigris
In 20 you can do FileSystemError package and you get it.

now we should work a lot to remove packageInfo and PackageOrganizer

We will work (with ben) on the following scenario to offer a backward compatible solution:

> the idea was:
>
> when loading an MC package, this will be one RPacka of the name of the MC package.
>
> For all the categories inside the MC pacakge, we use the rest as tags for the classes.
>
> this means that
>
> OpalCompiler-Core.mzc
>
> --> one Package OpalCompiler-Core
>
> tags
>
> Bytecode
> Extras
> FrontEnd
> IR
> Semantics
> Translator

Now it means that it will take time to get rid of categories.
Stef



On Jun 16, 2012, at 5:57 AM, Sean P. DeNigris wrote:

> "PackageOrganizer default packageOfClass: FileSystemError" returns the
> category, whether it's a separate package or not. How do I get the mc
> package?
>
> The only thing I can think of is something like:
> MCWorkingCopy allInstances detect: [ :e | e packageName beginsWith: aString
> ]
> but it seems like there should be a built-in way, and the above is naive
> e.g. if aString = 'Package', the condition will be true for Package and
> PackageTests, which is wrong...
>
> Thanks,
> Sean
>
> --
> View this message in context: http://forum.world.st/Finding-the-package-of-a-class-tp4635070.html
> Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
>


Reply | Threaded
Open this post in threaded view
|

Re: Finding the package of a class

Sean P. DeNigris
Administrator
In reply to this post by Sean P. DeNigris
Sean P. DeNigris wrote
How do I get the mc package?
This ugly thing is the best I could come up with...
MCPackage allInstances detect: [ :pkg | pkg packageInfo includesSystemCategory: categoryName ] ].

b.t.w. I found it very confusing that there are packages, package infos, versions, version infos... will Ring simplify this, or is that totally different?
Cheers,
Sean
Reply | Threaded
Open this post in threaded view
|

Re: Finding the package of a class

Benjamin Van Ryseghem (Pharo)
If you have Nautilus loaded, there is a class which stores the bindings between RPackage and MCPackage, so you can query it .

But yes, it's a mess to have at least two different representation for the same things

Ben

On Jun 17, 2012, at 4:10 PM, Sean P. DeNigris wrote:

>
> Sean P. DeNigris wrote
>>
>> How do I get the mc package?
>>
>
> This ugly thing is the best I could come up with...
> MCPackage allInstances detect: [ :pkg | pkg packageInfo
> includesSystemCategory: categoryName ] ].
>
> b.t.w. I found it very confusing that there are packages, package infos,
> versions, version infos... will Ring simplify this, or is that totally
> different?
>
> --
> View this message in context: http://forum.world.st/Finding-the-package-of-a-class-tp4635070p4635212.html
> Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
>


Reply | Threaded
Open this post in threaded view
|

Re: Finding the package of a class

Guillermo Polito
And actually, 4:

- RPackage.
- PackageInfo
- MCPackage
- SystemOrganization(for categories) + ClassOrganizer(for extension methods)

;)

Yeah, we have to tackle them.

On Sun, Jun 17, 2012 at 4:24 PM, Benjamin <[hidden email]> wrote:
If you have Nautilus loaded, there is a class which stores the bindings between RPackage and MCPackage, so you can query it .

But yes, it's a mess to have at least two different representation for the same things

Ben

On Jun 17, 2012, at 4:10 PM, Sean P. DeNigris wrote:

>
> Sean P. DeNigris wrote
>>
>> How do I get the mc package?
>>
>
> This ugly thing is the best I could come up with...
> MCPackage allInstances detect: [ :pkg | pkg packageInfo
> includesSystemCategory: categoryName ] ].
>
> b.t.w. I found it very confusing that there are packages, package infos,
> versions, version infos... will Ring simplify this, or is that totally
> different?
>
> --
> View this message in context: http://forum.world.st/Finding-the-package-of-a-class-tp4635070p4635212.html
> Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
>



Reply | Threaded
Open this post in threaded view
|

Re: Finding the package of a class

Stéphane Ducasse
In reply to this post by Sean P. DeNigris

On Jun 17, 2012, at 4:10 PM, Sean P. DeNigris wrote:

>
> Sean P. DeNigris wrote
>>
>> How do I get the mc package?
>>
>
> This ugly thing is the best I could come up with...
> MCPackage allInstances detect: [ :pkg | pkg packageInfo
> includesSystemCategory: categoryName ] ].
>
> b.t.w. I found it very confusing that there are packages, package infos,
> versions, version infos... will Ring simplify this, or is that totally
> different?

No ring is orthogonal. It is just a code model.
Now we are working on removing PackageInfo and packageOrganizer, then the second one is
MCPackage.

Stef