Login  Register

Changing method definition at runtime

Posted by ericvm on Jul 22, 2016; 9:59pm
URL: https://forum.world.st/Changing-method-definition-at-runtime-tp4907542.html

Hello,

One thing I try to do often is changing the behaviour of a method dynamically at runtime. The current way I do this is by having a block as an instance variable and having the method call this block, but I find this approach a bit cumbersome. Is there some other way or is this the recommended approach?

I mean, I suppose methods could be changed dynamically by means of reflection somehow, but is this an easy or recommended way of programming in Smalltalk? Should slots make things easier?

Eric