Why does this TCL proc with no args not work?
Question
This should be an easy one for someone...
I had a function in a TCL script called unwrap. Modifying it, I realized I no longer needed to pass it args.
So I changed it to
unwrap {} {
...
}
Now when I call it with no args, i.e.:
unwrap
I get an error invalid command unwrap
Ideas? How do I properly format a TCL function with no args?
I tried to use this reference, which showed a call identical to mine:
http://users.belgacom.net/bruno.champagne/tcl.html
Is that page incorrect?
FYI, removing the inner code and inserting it into the spot of the call works, so I know its just my syntax, not the function code itself.
Thanks in advance!
Solution
You forgot the proc
proc unwrap {} {
}
What probably happened in your interpreter was that you defined unwrap
with args first, and then when you forgot the proc
the second time, you didn't get an error b/c the interpreter just thought you were calling unwrap
itself (instead of redefining it, which is what you wanted).