On 23 May 2018, at 13:30, Thierry Goubier <thierry.goubier@gmail.com> wrote:
2018-05-23 13:20 GMT+02:00 Sean P. DeNigris <sean@clipperadams.com>:
Marcus Denker-4 wrote
method := Smalltalk compiler environment: environment; compile: 'tt ^MyClassâ.
Awesome! Is it possible to override a global from /within/ a method (e.g. in a test)?
I think at the class level by manipulating that class compiler
Yes. You can override the class side method: in Behaviour, it is defined as compiler "Answer a compiler appropriate for source methods of this class." ^self compilerClass new environment: self environment; class: self so you can just compiler âChange the compiler environment " ^super compiler environment: self myEnvironment and it should work. an a per method bases, we can only manipulate the compiler via Pragmas to set options: <compilerOptions: #(+ optionInlineTimesRepeat)> for example.
(and forcing a method recompile...)
indeed.. I still believe that we should late-bind global access :-) Marcus