diff options
-rw-r--r-- | ChangeLog | 11 | ||||
-rw-r--r-- | doc/global.n | 9 | ||||
-rw-r--r-- | generic/tclVar.c | 7 | ||||
-rw-r--r-- | tests/proc-old.test | 5 | ||||
-rw-r--r-- | tests/var.test | 11 |
5 files changed, 28 insertions, 15 deletions
@@ -1,3 +1,14 @@ +2008-09-25 Don Porter <dgp@users.sourceforge.net> + + TIP #323 IMPLEMENTATION (partial) + + * doc/global.n: Revise [global] to accept zero variable names. + * generic/tclVar.c: + * tests/proc-old.test: + * tests/var.test: + + * doc/global.n: Correct false claim about [info locals]. + 2008-09-25 Donal K. Fellows <dkf@users.sf.net> TIP #315 IMPLEMENTATION diff --git a/doc/global.n b/doc/global.n index e330954..bcf4391 100644 --- a/doc/global.n +++ b/doc/global.n @@ -5,7 +5,7 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" RCS: @(#) $Id: global.n,v 1.12 2007/12/13 15:22:32 dgp Exp $ +'\" RCS: @(#) $Id: global.n,v 1.13 2008/09/25 19:26:36 dgp Exp $ '\" .so man.macros .TH global n "" Tcl "Tcl Built-In Commands" @@ -14,15 +14,16 @@ .SH NAME global \- Access global variables .SH SYNOPSIS -\fBglobal \fIvarname \fR?\fIvarname ...\fR? +\fBglobal \fR?\fIvarname ...\fR? .BE .SH DESCRIPTION .PP This command has no effect unless executed in the context of a proc body. If the \fBglobal\fR command is executed in the context of a proc body, it -creates local variables linked to the corresponding global variables (and -therefore these variables are listed by info locals). +creates local variables linked to the corresponding global variables (though +these linked variables, like those created by \fBupvar\fR, are not included +in the list returned by \fBinfo locals\fR). .PP If \fIvarname\fR contains namespace qualifiers, the local variable's name is the unqualified name of the global variable, as determined by the diff --git a/generic/tclVar.c b/generic/tclVar.c index f4e1ad3..e609c70 100644 --- a/generic/tclVar.c +++ b/generic/tclVar.c @@ -16,7 +16,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclVar.c,v 1.166 2008/08/06 20:58:49 msofer Exp $ + * RCS: @(#) $Id: tclVar.c,v 1.167 2008/09/25 19:26:38 dgp Exp $ */ #include "tclInt.h" @@ -3833,11 +3833,6 @@ Tcl_GlobalObjCmd( register char *tail; int result, i; - if (objc < 2) { - Tcl_WrongNumArgs(interp, 1, objv, "varName ?varName ...?"); - return TCL_ERROR; - } - /* * If we are not executing inside a Tcl procedure, just return. */ diff --git a/tests/proc-old.test b/tests/proc-old.test index d0a116e..29a0607 100644 --- a/tests/proc-old.test +++ b/tests/proc-old.test @@ -14,7 +14,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: proc-old.test,v 1.16 2008/07/19 22:50:39 nijtmans Exp $ +# RCS: @(#) $Id: proc-old.test,v 1.17 2008/09/25 19:26:39 dgp Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest @@ -284,9 +284,6 @@ test proc-old-5.7 {error conditions} { test proc-old-5.8 {error conditions} { catch {return} } 2 -test proc-old-5.9 {error conditions} { - list [catch {global} msg] $msg -} {1 {wrong # args: should be "global varName ?varName ...?"}} proc tproc {} { set a 22 global a diff --git a/tests/var.test b/tests/var.test index 5797434..c160cbd 100644 --- a/tests/var.test +++ b/tests/var.test @@ -14,7 +14,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: var.test,v 1.32 2008/07/13 23:15:22 nijtmans Exp $ +# RCS: @(#) $Id: var.test,v 1.33 2008/09/25 19:26:40 dgp Exp $ # if {[lsearch [namespace children] ::tcltest] == -1} { @@ -352,6 +352,15 @@ test var-6.4 {Tcl_GlobalObjCmd, variable name matching :*} { p set :v } {fixed} +test var-6.5 {Tcl_GlobalObjCmd, no-op case (TIP 323)} { + global +} {} +test var-6.6 {Tcl_GlobalObjCmd, no-op case (TIP 323)} { + proc p {} { + global + } + p +} {} test var-7.1 {Tcl_VariableObjCmd, create and initialize one new ns variable} { catch {namespace delete test_ns_var} |