(redirected from Main.AlwaysLeaveTheBodyBraceOnTheSameLineAsTheProc)
Tcl is very finicky about where things are placed. Unlike other programming languages, location and white space seem to make a big difference to Tcl.
For example, compare the brace placement on this snippet:
- proc ::testegg::msg_test {nick userhost hand text}
- {
- set msg "nick=$nick. userhost=$userhost. hand=$hand. text=$text"
- putcmdlog [concat "testegg: " $msg]
- putserv [concat "PRIVMSG " $nick " :" $msg]
- return 1
- }
to the brace placement on this one:
- proc ::testegg::msg_test {nick userhost hand text} {
- set msg "nick=$nick. userhost=$userhost. hand=$hand. text=$text"
- putcmdlog [concat "testegg: " $msg]
- putserv [concat "PRIVMSG " $nick " :" $msg]
- return 1
- }
The first example will fail, because Tcl wants the body opening brace to be on the same line as the proc command.
I think it took me about 3 hours to figure that out...
| Tags: | Categories: Articles |
Recent Changes |
Printable View |
Page History |
Edit Page
Page last modified on April 09, 2012, at 09:03 AM by tamara