autocategorizing

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

autocategorizing

Peter Uhnak
How does autocategorizing decides what to put where?

For example I have (on class-side) three methods
#example
#example2
#exampleClusters

after autocategorizing they end up being

#example in 'example' protocol
#example2 in 'examples' protocol
#exampleClusters in 'as yet unclassified' protocol

That seems really odd, shouldn't all of them be in the same protocol?

Also is 'example' or 'examples' the normative protocol?

Thanks,
Peter
Reply | Threaded
Open this post in threaded view
|

Re: autocategorizing

Stephan Eggermont-3
On 11-11-15 10:36, Peter Uhnák wrote:

> How does autocategorizing decides what to put where?
>
> For example I have (on class-side) three methods
> #example
> #example2
> #exampleClusters
>
> after autocategorizing they end up being
>
> #example in 'example' protocol
> #example2 in 'examples' protocol
> #exampleClusters in 'as yet unclassified' protocol
>
> That seems really odd, shouldn't all of them be in the same protocol?

Depends on superclass, your use of pragmas (and extension methods):

MethodClassifier>>classify:
        (self classifyAccessor: aMethod)
                ifTrue: [ ^ aMethod category ].
        (self classifyInSuperclassProtocol: aMethod)
                ifTrue: [ ^ aMethod category ].
               
        (self classifyByKnownPrefix: aMethod)
                ifTrue: [ ^ aMethod category ].
        (self classifyByOtherImplementors: aMethod)
                ifTrue: [ ^ aMethod category ].
        (self classifyByKnownPragma: aMethod)
                ifTrue: [ ^ aMethod category ].

 > Also is 'example' or 'examples' the normative protocol?

examples
https://pharo.fogbugz.com/f/cases/16841/MethodClassifier-should-classify-on-pragma
https://pharo.fogbugz.com/f/cases/16842/Recategorize-example-examples

MethodClassifier>>buildPragmaDictionary
        pragmaMapping := Dictionary new.
        pragmaMapping
                at: 'example' put: 'examples'.

'example' is currently not in the list of known prefixes.

Stephan