title: Changing Implementation/Class at runtime
body: <p>I am looking for real world examples of (open source) programs (or algorithms) that change the concrete class of an object (or variable) at runtime.</p>
  
  <p>An example of such behaviour in Java could look like the code snipper below.
  Here, a <code>LinkedList</code>, which performs well in the context of frequent inserts and/or removes, is changed into an <code>ArrayList</code>, which performs well in the context of random access and iteration.</p>
  
  <pre><code>List myList = new LinkedList(); 
  /* Lots of inserts */
  ...
  myList = new ArrayList( myList ); // 'change' into different class
  /* Lots of iteration */
  ...
  </code></pre>
  
  <p>The Java example above changes between <code>LinkedList</code> and <code>ArrayList</code> for the
  sake of performance.</p>
  
  <p>However, examples in any language, for any data structure, using any technique*, and for any reason are welcome.</p>
  
  <p>*Technique: plain and simple like in the example above, or
  using <code>become:</code> in SmallTalk,or <code>__class__</code> in Python, or ...</p>