VAST Tips: More on compiling methods


Yesterday I showed you a code snippet for compiling an instance method to a class. If you want to compile a method as a class method you simply send the very same method to the Class’ class. Example:

MyClass class compile: 'testMethod
^OrderedCollection new'
notifying: Transcript
ifNewAddTo: MyApplication
categorizeIn: #('Great Tip from Joachim').

I won’t go into details about what object actually is the receiver of this message, just keep in mind that this will compile a class method.