Reputation: 179
given that not_there isn't a proc I would expect
[info procs not_there] eq ""
to return 0, but I'm seeing
empty command name ""
could someone explain my conceptual error?
Upvotes: 0
Views: 179
Reputation: 1873
This statement of yours:
[info procs not_there] eq ""
will first have info procs not_there
evaluated by the Tcl interpreter. Next the interpreter will evaluate the equivalent of this statement:
"" eq ""
...where the first word ""
is not a valid command.
In the Tcl statements, the first word must always be a command. command arg arg arg...
What you're missing is using the expr
command at the beginning
expr {"" eq ""} --> 1
expr {[info procs not_there] eq ""} --> 1
By the way, the expr
is implied in the conditional argument of the if
statement:
if {[info procs not_there] eq ""} {
puts "This is not a proc"
}
Upvotes: 2