Re: [Pharo-users] Changing method definition at runtime

2016-07-26 Thread Eric Velten de Melo
Ben's solution worked perfectly for me. Thanks! Also I had a look at Stef's article but still need to read it more carefully. Thank you all for the references and advice! Eric 2016-07-24 17:48 GMT-03:00 stepharo : > Have a look at my JOOP'99 article because I explain how to develop > instance

Re: [Pharo-users] Changing method definition at runtime

2016-07-24 Thread stepharo
Have a look at my JOOP'99 article because I explain how to develop instance specific behavior. Stef Le 24/7/16 à 17:14, Eric Velten de Melo a écrit : Actually I wanted to have many different object instances with different behaviours picked at random from a list of available behaviours, but

Re: [Pharo-users] Changing method definition at runtime

2016-07-24 Thread Ben Coman
On Sun, Jul 24, 2016 at 11:14 PM, Eric Velten de Melo wrote: > Actually I wanted to have many different object instances with different > behaviours picked at random from a list of available behaviours, but didn't > find practical to create a class for each different method implementation > and de

Re: [Pharo-users] Changing method definition at runtime

2016-07-24 Thread Steven Costiou
As i'm trying to build some kind of context oriented mechanism, i have the same need of behavior modification for a single instance of a class. I use virus-proxies in Ghost, that can intercept a message upon its reception in a particular object. From there it is possible to choose the code you want

Re: [Pharo-users] Changing method definition at runtime

2016-07-24 Thread Eric Velten de Melo
Actually I wanted to have many different object instances with different behaviours picked at random from a list of available behaviours, but didn't find practical to create a class for each different method implementation and delegating to it, since there are many, possibly unlimited valid behavio

Re: [Pharo-users] Changing method definition at runtime

2016-07-23 Thread Norbert Hartl
Can you elaborate on the reason why want to modify behaviour? And how you would like it to happen? If the code you want to modify is your own code than you can solve that most of time with the things you already have. Your example using a block might be altered to be a strategy pattern. That me

Re: [Pharo-users] Changing method definition at runtime

2016-07-23 Thread Thierry Goubier
Hi Steven, Eric, it can be done very easily by just recompiling the method, with optionally handling the fact that the underlying package may be marked as dirty. (i.e. have multiple method implementations, and switching between them by just calling #compile: on the class). Regards, Thierr

Re: [Pharo-users] Changing method definition at runtime

2016-07-23 Thread Steven Costiou
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

[Pharo-users] Changing method definition at runtime

2016-07-22 Thread Eric Velten de Melo
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 recommend