strange tcl behavior



Hello everybody!

I have a big problem with a TCL script. I will do my best to describe
the behavior:

I have a C program that defines some custom TCL commands. The program
parses an input TCL file.
When it starts the parsing the only custom command is defobj <name>
<alias>. What that command does is to create two new commands: "name"
and an alias to it called "alias".

The startup script does the following:

if { [info commands "custom_command"] == "" } {
source prim_script.tcl
}

The prim_script.tcl is:

set test_var custom_command
....
if { $test_var == "custom_command" } {
{
puts $test_var
defobj custom_command custom_alias
puts $test_var
}
......


When I run the script I get the following output:
custom_command
custom_alias

The crazy thing is that if I change the startup script to:

puts [info commands "custom_command"] == "" } {
source prim_script.tcl
}


Can somebody help me understand why the value of test_var is changed
to cusom_alias ?

Thank you,
Ionut Anghelcovici



.



Relevant Pages

  • Re: Key-passing from PHP to TCL CGI script - how is it done (web security issue)?
    ... TCL v.8.3 ... set hasEnteredTrivia 0 ... # NEW 8/7/2004 USE PHP (AS CGI) TO CHECK IF USER IS ATTEMPTING TO ENTER ... # USE REMOTE PHP SCRIPT TO CHECK FOR REPOSTING ...
    (comp.lang.tcl)
  • embedded Tcl performance -- how to make it faster?
    ... My application already provides a limited scripting language to our ... I set off to embed Tcl. ... (Embedded Ruby ... and then retrieve results back in the app once the script ...
    (comp.lang.tcl)
  • Expect: interact and buffering?
    ... with the tcl application and terminated it. ... remaining output would display and the Expect script would end. ... I have changed the interact in an attempt to make it process character ...
    (comp.lang.tcl)
  • Re: No argv, argc for worker thread
    ... I expected that a Tcl interpreter started in any manner would accept options ... This is how the interpreter works with command line options ... a "main" script processes command line ...
    (comp.lang.tcl)
  • Re: Functional programming versus TCL-like strings rant
    ... > Someone suggested that using combinations of custom-built control ... I assume you mean a script built up at ... In a language like Tcl, ... * Tcl uses a limited form of lexical/static scoping for commands ...
    (comp.lang.tcl)