Hello, a mean to achieve behavior modification of methods at runtime could be context oriented programming (COP). It allows a method to have multiple behavior variations that can be (de)activated dynamically. However to my knowledge there is no context oriented extension for Pharo yet.
I would also be interested by any known way to change method behavior dynamically, as COP is not an option for now. Maybe by working on ast nodes, by dynamically replacing them ? Steven. Le 2016-07-23 00:41, Eric Velten de Melo a écrit : > 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 -- kloum.io