Beginners questions .... method protocols...

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

Beginners questions .... method protocols...

Marten Feldtmann-2
I tried to organize my methods into different method protocols, but whenever I try to create a new method protocol I get the error message, that the class does not understand #organizer.

Any ideas ?
Reply | Threaded
Open this post in threaded view
|

Re: Beginners questions .... method protocols...

Nicolas Petton

My guess is that you use the master version of Amber? ClassOrganizer
was introduced recently, and may very well include bugs. I think you
just found one :)

Can you report an issue entry in Github?

Nico

Marten Feldtmann <[hidden email]> writes:

> I tried to organize my methods into different method protocols, but
> whenever I try to create a new method protocol I get the error message,
> that the class does not understand #organizer.
>
> Any ideas ?

--
Nicolas Petton
http://nicolas-petton.fr
Reply | Threaded
Open this post in threaded view
|

Re: Beginners questions .... method protocols...

Marten Feldtmann-2
In reply to this post by Marten Feldtmann-2
In "Kernel-Package" and Class "CompiledMethod" one might change the method to allow reorganization of methods again.


category: aString
    | oldCategory |
    oldCategory := self category.
    self basicAt: 'category' put: aString.
    
    self methodClass ifNotNil: [
        self methodClass organization addElement: aString.
    
        (self methodClass methods
            select: [ :each | each category = oldCategory ])
            ifEmpty: [ self methodClass organization removeElement: oldCategory ] ]
Reply | Threaded
Open this post in threaded view
|

Re: Beginners questions .... method protocols...

Nicolas Petton

Marten,

Could you add that as a proposed fix on github?

Thanks,
Nico

Marten Feldtmann <[hidden email]> writes:

> In "Kernel-Package" and Class "CompiledMethod" one might change the method
> to allow reorganization of methods again.
>
>
> category: aString
>     | oldCategory |
>     oldCategory := self category.
>     self basicAt: 'category' put: aString.
>    
>     self methodClass ifNotNil: [
>         self methodClass organization addElement: aString.
>    
>         (self methodClass methods
>             select: [ :each | each category = oldCategory ])
>             ifEmpty: [ self methodClass organization removeElement:
> oldCategory ] ]
--
Nicolas Petton
http://nicolas-petton.fr