[Newbies] Method category tags

cdrick cdrick65 at gmail.com
Mon Feb 25 17:09:49 UTC 2008


In a recent post, Matthew Fulmer explained how categories work... and
I don't really see why they exist this way... Can someone explain me
(historical reason, etc...)?

>"In Squeak, Classes are objects, methods are objects, but
>categories are not. Categories are implemented interestingly.
>See Categorizer and subclasses. Categorizer stores two lists of
>Symbols; one is the list of all the categories, the other is the
>list of all the class names or method names, arranged so that
>all the names in the first part of the list are in the first
>category, the next few methods are in category 2, and so forth.
>So all the categories are is a symbol in a special list, with
>the mapping to classes and methods is maintained by other
>How would changing this work? Mostly, Browser would have to be
>changed significantly. OmniBrowser would probably be easier to
>adapt, but I have only worked with Browser, so I cannot comment."

I don't mind method categories are not first class but I find quite
annoying and limited to use them (there is not even a list of usual
categories except in the class side...).

My wish is I'd like to define categories as tags so I can attach
several to method. This could be interesting to declare private method
and classes extensions...

Would it be possible and would you find useful to have that
possibility ? Maybe we could use a pragma like syntax.

<category: #private category: #accessing category: #toRefactor
extension: myPackage trait: TPureBehavior>

Matthew also said we could adopt Namespace/Category like Gulik's work on
namespaces, as Namespaces are much like reified Categories.

What do you think ? Am I the only one annoyed the way method
categories works (maybe another newbie reflex and maybe I don't get
the power of categories the way they are...).



More information about the Beginners mailing list