[Pharo-dev] methods not registered in packages?

tesonep at gmail.com tesonep at gmail.com
Sun Feb 9 09:04:43 EST 2020


Hi Doru,
  thanks for checking this behavior. Those methods are not correctly
packaged because those are methods added from a trait.  Nowadays,
#methods returns all the methods in the class (the ones defined in the
class and the ones defined in the used traits) and #localMethods
returns the methods defined only in the class.

I think it is a good issue to open so we can discuss which is the best
API for it. Maybe the existing one is not good. To me, #methods should
not return all the methods from the method dictionary or we have to
encourage to use the #localMethods where #methods is used.
I am not sure about what is the answer, so the issue to discuss will be perfect.

Cheers,
Pablo

On Sun, Feb 9, 2020 at 8:16 AM Tudor Girba <tudor at tudorgirba.com> wrote:
>
> Hi,
>
> While trying to measure the size of code, I stumbled across an interesting problem: it seems that some methods have a package, but the package does not list.
>
> packagedMethods := RPackageOrganizer default packages flatCollect: #methods.
> methods := ProtoObject withAllSubclasses flatCollect: #methods.
> diff := methods \ packagedMethods.
> diff size.
> “7249"
>
> Looking at bit closer, it looks like the methods do have a package and that they point to the package that is in the package organizer, so that is good:
>
> diff select: [ :each | each package isNil ]
> "an OrderedCollection()".
>
> diff select: [ :each | (RPackageOrganizer default packages includes: each package) not ].
> "an OrderedCollection()”
>
> However, when we ask the package, it does not know about the method:
>
> diff select: [ :each | each package methods includes: each ]
> "an OrderedCollection()”
>
>
> Is this a known problem or should I open an issue (I did not find a bug report for it)?
>
>
> Cheers,
> Doru
>
>
> --
> feenk.com
>
> "Presenting is storytelling."
>
>


-- 
Pablo Tesone.
tesonep at gmail.com



More information about the Pharo-dev mailing list