compile:inClass:, compile:inClass:ifFail, compile:inClass:warningLevel:onWarning:ifFail:
Each of these messages compiles the source code provided in the first parameter in the context of the second parameter, which must be a class. To compile in the context of a class means that the compiler will try to interpret variable references as instance, class, or pool variables of the designated class. These messages return a CompiledMethod if they are successful. The compile:inClass: message uses default error handling that returns nil if a warning or error is detected. The compile:inClass:ifFail: message accepts a fail block as the third parameter, and answers the result of evaluating the fail block if a warning or error is detected. The compile:inClass:warningLevel:onWarning:ifFail: message accepts a warning level, warning block, and fail block as parameters. If an error is detected, the result of evaluating the fail block as answered. If a warning is detected, the warning block is evaluated with an instance of CompilerError. If that answers true, the compile fails, and the CompilerError is answered. Otherwise the compile continues.
Porting tip:
Not supported in Smalltalk/V and Objectworks\Smalltalk, which each provide their own different messages to support compiling.
Last modified date: 01/29/2015