title: Embedded Tcl: Does Tcl autocomplete commands?
body: <p>We have a Tcl <strong>built in</strong> our C/C++ application, I found the place in our code where <strong>Tcl_EvalObjv</strong> is called if the command was not found. I have to admit that the code is pretty old and not many of our developers know what happens in this module.</p>
  
  <p>It looks like this:</p>
  
  <pre><code>// ... there is some checking if command is registered etc., it fails and the code goes here:
  std::vector&lt;Tcl_Obj*&gt; tclArgs = { NULL };
  for (int i = 1; i &lt; objc; ++i)
      tclArgs.push_back(objv[i]);
  tclArgs.shrink_to_fit();
  // ...
  tclArgs[0] = ::Tcl_NewStringObj(ORIGINAL_UNKNOWN, ORIGINAL_UNKNOWN_SIZE);
  Tcl_IncrRefCount(tclArgs[0]);
  ::Tcl_ExposeCommand(pInterp, ORIGINAL_UNKNOWN, ORIGINAL_UNKNOWN);
  result = ::Tcl_EvalObjv(pInterp, objc, &amp;tclArgs[0], TCL_EVAL_GLOBAL); //&lt;--
  ::Tcl_HideCommand(pInterp, ORIGINAL_UNKNOWN, ORIGINAL_UNKNOWN);
  // ORIGINAL_UNKNOWN is char* it is just "unknown"
  </code></pre>
  
  <p>We have handlers for commands in our application, while executing <strong>Tcl_EvalObjv</strong> in <strong>CmdUnknown()</strong> function <strong>Tcl</strong> sometimes calls different commands. Examples below:</p>
  
  <p>List of existing commands: "banana", "applepie", "carpet", "card"</p>
  
  <p><strong>Command: "apple", Tcl calls "applepie" (wrong, "apple" is not "applepie")<br></strong> 
  Command: "blah", Tcl gives error (correctly).<br>
  Command: "car", Tcl gives error (correctly, maybe because of 2 similar commands).<br><br>
  Is there are some kind of mechanism that <strong>Tcl</strong> does when it fails in searching for command? The thing is that I can't find anything that is related to our code that would complete the commands so maybe <strong>Tcl</strong> does?</p>