summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2008-09-26 20:16:38 (GMT)
committerdgp <dgp@users.sourceforge.net>2008-09-26 20:16:38 (GMT)
commit03fe58895ff5d2fff94410b80ecf3fd7907b7948 (patch)
tree756a76460a8221b5d7928f2edc5ff71491439c93
parent030aaf8733e03063daa3c730c5b258575b9386ba (diff)
downloadtcl-03fe58895ff5d2fff94410b80ecf3fd7907b7948.zip
tcl-03fe58895ff5d2fff94410b80ecf3fd7907b7948.tar.gz
tcl-03fe58895ff5d2fff94410b80ecf3fd7907b7948.tar.bz2
TIP #323 IMPLEMENTATION (partial)
* doc/object.n: Revise standard oo method [my variable] to * generic/tclOOBasic.c: accept zero variable names. * tests/oo.test:
-rw-r--r--ChangeLog4
-rw-r--r--doc/object.n4
-rw-r--r--generic/tclOOBasic.c6
-rw-r--r--tests/oo.test12
4 files changed, 20 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 2f53284..cbf1c85 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,10 @@
TIP #323 IMPLEMENTATION (partial)
+ * doc/object.n: Revise standard oo method [my variable] to
+ * generic/tclOOBasic.c: accept zero variable names.
+ * tests/oo.test:
+
* doc/tm.n: Revise [tcl::tm::path add] and
* library/tm.tcl: [tcl::tm::path remove] to accept zero paths.
* tests/tm.test:
diff --git a/doc/object.n b/doc/object.n
index eec3219..47acd04 100644
--- a/doc/object.n
+++ b/doc/object.n
@@ -4,7 +4,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
-'\" RCS: @(#) $Id: object.n,v 1.2 2008/06/28 23:43:45 dkf Exp $
+'\" RCS: @(#) $Id: object.n,v 1.3 2008/09/26 20:16:39 dgp Exp $
'\"
.so man.macros
.TH object n 0.1 TclOO "TclOO Commands"
@@ -63,7 +63,7 @@ by the \fBoo::object\fR class) generates a suitable error, detailing what
methods the object supports given whether the object was invoked by its public
name or through the \fBmy\fR command.
.TP
-\fIobj \fBvariable \fIvarName \fR?\fIvarName ...\fR?
+\fIobj \fBvariable \fR?\fIvarName ...\fR?
.
This method arranges for each variable called \fIvarName\fR to be linked from
the object \fIobj\fR's unique namespace into the caller's context. Thus, if it
diff --git a/generic/tclOOBasic.c b/generic/tclOOBasic.c
index 9df3907..2e3868d 100644
--- a/generic/tclOOBasic.c
+++ b/generic/tclOOBasic.c
@@ -9,7 +9,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclOOBasic.c,v 1.10 2008/09/01 12:28:09 msofer Exp $
+ * RCS: @(#) $Id: tclOOBasic.c,v 1.11 2008/09/26 20:16:39 dgp Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -467,9 +467,9 @@ TclOO_Object_LinkVar(
Namespace *savedNsPtr;
int i;
- if (objc-Tcl_ObjectContextSkippedArgs(context) < 1) {
+ if (objc-Tcl_ObjectContextSkippedArgs(context) < 0) {
Tcl_WrongNumArgs(interp, Tcl_ObjectContextSkippedArgs(context), objv,
- "varName ?varName ...?");
+ "?varName ...?");
return TCL_ERROR;
}
diff --git a/tests/oo.test b/tests/oo.test
index f221e1f..7d328f6 100644
--- a/tests/oo.test
+++ b/tests/oo.test
@@ -7,7 +7,7 @@
# See the file "license.terms" for information on usage and redistribution of
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# RCS: @(#) $Id: oo.test,v 1.13 2008/09/25 10:13:33 dkf Exp $
+# RCS: @(#) $Id: oo.test,v 1.14 2008/09/26 20:16:39 dgp Exp $
package require TclOO 0.4 ;# Must match value in configure.in
if {[lsearch [namespace children] ::tcltest] == -1} {
@@ -1542,6 +1542,16 @@ test oo-20.11 {OO: variable mustn't crash when recursing} -body {
} -cleanup {
catch {A destroy}
} -match glob -result *
+test oo-20.12 {OO: variable method accept zero args (TIP 323)} -setup {
+ oo::object create foo
+} -cleanup {
+ foo destroy
+} -body {
+ oo::objdefine foo method demo {} {
+ my variable
+ }
+ foo demo
+} -result {}
test oo-21.1 {OO: inheritance ordering} -setup {
oo::class create A