title: Consequences of Dynamically rewriting a function in javascript?
body: <p>In javascript, you can rewrite a function, like so:</p>
  
  <pre><code>function foo() { 
     setTimeout(function() {
          alert('sup stallion');
          foo = function() { //rewrite foo to nolonger wait 4 seconds to alert.
               alert('sup stallion');
          }
     }, 4000);
  }
  </code></pre>
  
  <p>Obviously this is a contrived example, but is there anything conceptually wrong with this approach (<strike>other than a race condition</strike>).</p>