title: Prevent Tcl from crashing on unknown command
body: <p>I'm doing <code>eval</code> on the content of file. The file is made out of labels which I parse. Each line has a label, and I have a <code>proc</code> defined for each label, so that the <code>eval</code> succeeds. However, sometimes users add new labels and then the <code>eval</code> command fails, because of unknown command.</p>
  
  <p>Is there a way to prevent Tcl from crashing when trying to <code>eval</code> an unknown command?<br>
  Ideally, it should allow me to substitute with my own defined behaviour - such as priting an error and continuing with the <code>eval</code>.</p>
  
  <hr>
  
  <p><strong>EDIT</strong>:  </p>
  
  <p>Unfortunately, I can only use Tcl 8.4.<br>
  I tried doing the following, <a href="http://www.tcl.tk/man/tcl8.4/TclCmd/unknown.htm" rel="nofollow">as suggested here</a>:</p>
  
  <pre><code>proc handle_unknown_label {cmd args} { ... }
  </code></pre>
  
  <p>and then:</p>
  
  <pre><code>rename unknown _old_system_unknown
  rename handle_unknown_label unknown
  
  catch {set ret [eval $x]} err
  
  rename unknown handle_unknown_label
  rename _old_system_unknown unknown
  </code></pre>
  
  <p>but I still get the same behavior for the <code>eval</code>, and it prints the following errors:</p>
  
  <blockquote>
    <p>procedure unknown is a protected proc and will not get renamed<br>
    procedure unknown is a protected proc and will not get overriden<br>
    procedure unknown is a protected proc and will not get renamed<br>
    procedure unknown is a protected proc and will not get overriden  </p>
  </blockquote>