diff options
author | dgp <dgp@users.sourceforge.net> | 2004-03-16 22:19:41 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2004-03-16 22:19:41 (GMT) |
commit | 7f955ebb347697e3262c2bf5469bd7552e4bda57 (patch) | |
tree | 6090cd73ac967c3e7e605d21c19e7e83ae2d63c5 | |
parent | 25dabc3b3448e17e9f8350b49ffc80346888cba9 (diff) | |
download | tcl-7f955ebb347697e3262c2bf5469bd7552e4bda57.zip tcl-7f955ebb347697e3262c2bf5469bd7552e4bda57.tar.gz tcl-7f955ebb347697e3262c2bf5469bd7552e4bda57.tar.bz2 |
* doc/catch.n: Compiled [catch] no longer fails to catch syntax
errors. Removed the claims in the documentation that it does.
* doc/return.n: Updated example to use [dict merge].
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | doc/catch.n | 19 | ||||
-rw-r--r-- | doc/return.n | 7 |
3 files changed, 10 insertions, 22 deletions
@@ -1,3 +1,9 @@ +2004-03-16 Don Porter <dgp@users.sourceforge.net> + + * doc/catch.n: Compiled [catch] no longer fails to catch syntax + errors. Removed the claims in the documentation that it does. + * doc/return.n: Updated example to use [dict merge]. + 2004-03-16 Jeff Hobbs <jeffh@ActiveState.com> * unix/configure, unix/tcl.m4: add -Wno-strict-aliasing for GCC to diff --git a/doc/catch.n b/doc/catch.n index d69670d..65a184c 100644 --- a/doc/catch.n +++ b/doc/catch.n @@ -6,7 +6,7 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" RCS: @(#) $Id: catch.n,v 1.8 2003/09/02 21:49:42 dgp Exp $ +'\" RCS: @(#) $Id: catch.n,v 1.9 2004/03/16 22:19:43 dgp Exp $ '\" .so man.macros .TH catch n "8.5" Tcl "Tcl Built-In Commands" @@ -78,14 +78,6 @@ dictionary of return options, and the \fBreturn\fR command may be used by scripts to set return options in addition to those defined above. .VE 8.5 -.PP -Note that \fBcatch\fR catches all exceptions, including those -generated by \fBbreak\fR and \fBcontinue\fR as well as errors. The -only errors that are not caught are syntax errors found when the -script is compiled. This is because the catch command only catches -errors during runtime. When the catch statement is compiled, the -script is compiled as well and any syntax errors will generate a Tcl -error. .SH EXAMPLES @@ -98,15 +90,6 @@ if { [catch {open $someFile w} fid] } { exit 1 } .CE -The \fBcatch\fR command will not catch compiled syntax errors. The -first time proc \fBfoo\fR is called, the body will be compiled and a -Tcl error will be generated. - -.CS -proc foo {} { - catch {expr {1 +- }} -} -.CE There are more complex examples of \fBcatch\fR usage in the documentation for the \fBreturn\fR command. diff --git a/doc/return.n b/doc/return.n index 55ddf96..58c4bd1 100644 --- a/doc/return.n +++ b/doc/return.n @@ -6,7 +6,7 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" RCS: @(#) $Id: return.n,v 1.8 2003/09/03 16:24:31 dgp Exp $ +'\" RCS: @(#) $Id: return.n,v 1.9 2004/03/16 22:19:43 dgp Exp $ '\" .so man.macros .TH return n 8.5 Tcl "Tcl Built-In Commands" @@ -140,7 +140,7 @@ The \fB-level\fR and \fB-code\fR options work together to set the return code to be returned by one of the commands currently being evaluated. The \fIlevel\fR value must be a non-negative integer representing a number of levels on the call stack. It defines the number of levels up the stack -at which the return code of command currently being evaluated should +at which the return code of a command currently being evaluated should be \fIcode\fR. If no \fB-level\fR option is provided, the default value of \fIlevel\fR is 1, so that \fBreturn\fR sets the return code that the current procedure returns to its caller, 1 level up the call stack. The @@ -298,8 +298,7 @@ proc myReturn {args} { set result [lindex $args end] set args [lrange $args 0 end-1] } - set options [eval \\ - [list dict create -level 1] $args] + set options [dict merge {-level 1} $args] dict incr options -level return -options $options $result } |