Hei Nokan,

Here's what you could do: Put a proxy object between the referencing
code and the object referenced. The proxy object could implement a
#become that simply replaces the object proxied to.

This way everyone points to the proxy object which stays the same, no
matter what object it points to, so references needn't change.

Pseudo-Code:

class Proxy < BlankSlate
  def method_missing(sym, *args, &block)
    @obj.send(sym, *args, &block)
  end
  def respond_to?(sym)
    @obj.respond_to?(sym)
  end
  def become(obj)
    @obj = obj
  end
end

More complex implementations are possible if you have more design
constraints - this is just the simplest thing that could work.

regards,
kaspar