> On 26 Feb 2018, at 22:59 , Steven Costiou <[email protected]
> <mailto:[email protected]>> wrote:
>
> Hi Pablo,
>
> thanks :) I will try Hermes.
>
> Basic scenario is adding/removing metalinks to a lot of a methods in an iot
> app:
>
> 1- If the add/remove occurs a lot of time, then there is a slowdown due to
> recompilation of methods. As this is a remote app, i want to try recompiling
> all methods locally then upload them. I will also try with Hermes.
>
>
> 2- If metalinks are put inside a loop that is running, for now i understand i
> cannot update the method unless i replace it on the stack. Experimenting that
> is somewhere in my todolist, but i'm taking any advice ;) Maybe that is not
> really possible.
>
>
> Steven.
My suggestion would be not to try updating methods that are on the stack, but
to update the methods that are executed in response to messages sent by what is
on the stack. So, for example, instead of
longRunningLoopThatHandlesEvents
[ terminationCondition ] whileFalse: [
big loop body inline here
]
write:
longRunningLoopThatHandlesEvents
[ terminationCondition ] whileFalse: [
self doOneIteration
]
doOneIteration
big loop body here
Then you can upload a new version of doOneIteration, and next time around the
even loop, that’s what will be executed. This is much cleaner; you don’t have
to worry about changing code in the midst of its execution and somehow
preserving the values of temporaries while you do so.
You can see the same thing in Pharo if you are examining an execution in the
debugger, and edit and recompile one of the executing methods. The method on
the stack won’t change, but after the execution context has popped off the
stack, you will see the new version execute in response to subsequent message
sends.
Andrew