Hi!

The java interpreter (as an example) allows hot code replacement. If you 
change the code of a method in the stack trace, the interpreter reloads 
the code and restarts the execution of that method.

Now I am wondering if it would be possible to achieve this behaviour 
also with the ruby interpreter.

An example:
---- start simple.rb
1: class A
2:  def m
3:    puts "stopHere"
4:  end
5:end
6:A.new.m
---- end simple.rb

Assume a breakpoint at line 3. There I want to be able to change 
"stopHere" to "somethingMoreInnovative" and then save it and have m 
restarted so that "somethingMoreInnovative" will be printed instead of 
"stopHere". Currently I do a "load simple.rb" after the change which 
indeed replaces the code but has several drawbacks:
* A.new.m will be executed a second time
* m is not "rewinded". The change will not take effect before m will be 
executed the next time
* if there were methods removed or renamed in A that wouldn't be 
reflected by the interpreter

Any ideas how real hot code replacement could be implemented in ruby?

thanks
Markus