From 7a8e8db83501823dbe441944d6107f249accb2e8 Mon Sep 17 00:00:00 2001 From: dgp Date: Fri, 26 Sep 2008 19:12:35 +0000 Subject: TIP #323 IMPLEMENTATION (partial) * doc/lassign.n: Revise [lassign] to accept zero variable names. * generic/tclCmdIL.c: * tests/cmdIL.test: --- ChangeLog | 8 ++++++++ doc/lassign.n | 4 ++-- generic/tclCmdIL.c | 6 +++--- tests/cmdIL.test | 14 +++++++------- 4 files changed, 20 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3c4d6a3..a033663 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2008-09-26 Don Porter + + TIP #323 IMPLEMENTATION (partial) + + * doc/lassign.n: Revise [lassign] to accept zero variable names. + * generic/tclCmdIL.c: + * tests/cmdIL.test: + 2008-09-26 Donal K. Fellows * generic/tclOO.h (TCLOO_VERSION): Bump the version. diff --git a/doc/lassign.n b/doc/lassign.n index 4d4a5af..57bd7b4 100644 --- a/doc/lassign.n +++ b/doc/lassign.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: lassign.n,v 1.5 2007/12/13 15:22:32 dgp Exp $ +'\" RCS: @(#) $Id: lassign.n,v 1.6 2008/09/26 19:12:40 dgp Exp $ '\" .so man.macros .TH lassign n 8.5 Tcl "Tcl Built-In Commands" @@ -14,7 +14,7 @@ .SH NAME lassign \- Assign list elements to variables .SH SYNOPSIS -\fBlassign \fIlist varName \fR?\fIvarName ...\fR? +\fBlassign \fIlist \fR?\fIvarName ...\fR? .BE .SH DESCRIPTION diff --git a/generic/tclCmdIL.c b/generic/tclCmdIL.c index a96f555..e1e15e1 100644 --- a/generic/tclCmdIL.c +++ b/generic/tclCmdIL.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: tclCmdIL.c,v 1.151 2008/08/21 23:57:43 msofer Exp $ + * RCS: @(#) $Id: tclCmdIL.c,v 1.152 2008/09/26 19:12:42 dgp Exp $ */ #include "tclInt.h" @@ -2060,8 +2060,8 @@ Tcl_LassignObjCmd( int listObjc; /* The length of the list. */ int code = TCL_OK; - if (objc < 3) { - Tcl_WrongNumArgs(interp, 1, objv, "list varName ?varName ...?"); + if (objc < 2) { + Tcl_WrongNumArgs(interp, 1, objv, "list ?varName ...?"); return TCL_ERROR; } diff --git a/tests/cmdIL.test b/tests/cmdIL.test index ca9377a..01fc09e 100644 --- a/tests/cmdIL.test +++ b/tests/cmdIL.test @@ -8,7 +8,7 @@ # See the file "license.terms" for information on usage and redistribution of # this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: cmdIL.test,v 1.40 2008/09/10 13:50:05 dkf Exp $ +# RCS: @(#) $Id: cmdIL.test,v 1.41 2008/09/26 19:12:42 dgp Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest 2 @@ -438,10 +438,10 @@ test cmdIL-5.5 {lsort with list style index and sharing} -body { # Compiled version test cmdIL-6.1 {lassign command syntax} -returnCodes error -body { apply {{} { lassign }} -} -result {wrong # args: should be "lassign list varName ?varName ...?"} -test cmdIL-6.2 {lassign command syntax} -returnCodes error -body { +} -result {wrong # args: should be "lassign list ?varName ...?"} +test cmdIL-6.2 {lassign command syntax} { apply {{} { lassign x }} -} -result {wrong # args: should be "lassign list varName ?varName ...?"} +} x test cmdIL-6.3 {lassign command} -body { apply {{} { set x FAIL @@ -534,13 +534,13 @@ test cmdIL-6.13 {lassign command syntax} -returnCodes error -body { set lassign lassign $lassign }} -} -result {wrong # args: should be "lassign list varName ?varName ...?"} -test cmdIL-6.14 {lassign command syntax} -returnCodes error -body { +} -result {wrong # args: should be "lassign list ?varName ...?"} +test cmdIL-6.14 {lassign command syntax} { apply {{} { set lassign lassign $lassign x }} -} -result {wrong # args: should be "lassign list varName ?varName ...?"} +} x test cmdIL-6.15 {lassign command} -body { apply {{} { set lassign lassign -- cgit v0.12