Object>>caseOf: (was Re: [Q] Enum style Object?)
ajh18 at cornell.edu
Wed Feb 19 18:10:19 UTC 2003
Hannes Hirzel <hannes.hirzel.squeaklist at bluewin.ch> wrote:
> I didn't even know that Object>>caseOf: exists!
> In my current 'productive' 3.5alpha image there are only three senders
> of this method: two in MessageNode and one in MethodFinder.
You didn't find all of the senders because caseOf: is inlined (see
MessageNode>>emitCase:on:value:). Try doing "method source with it". I
get 16 uses in the base image plus 9 more uses in my closure compiler.
Of course, still not many uses, but I still think it is useful for cases with a
small number of cases. Its more elegant than a sequence of ifs and more
straight forward then creating a special static dictionary or other structure.
More information about the Squeak-dev