summaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2008-09-23 05:05:41 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2008-09-23 05:05:41 (GMT)
commit282e134aeee90a7223dae8944b610c218aeaec78 (patch)
tree6be64065e9b0dc708cce2d80b40e8aa2bdad98b8 /doc
parent404405c0976f47e28629ed9441feaa565cf85d99 (diff)
downloadtcl-282e134aeee90a7223dae8944b610c218aeaec78.zip
tcl-282e134aeee90a7223dae8944b610c218aeaec78.tar.gz
tcl-282e134aeee90a7223dae8944b610c218aeaec78.tar.bz2
Implementation of TIP #320.#320.#320.
Diffstat (limited to 'doc')
-rw-r--r--doc/define.n28
-rw-r--r--doc/info.n24
2 files changed, 48 insertions, 4 deletions
diff --git a/doc/define.n b/doc/define.n
index a1a92bf..ddbf476 100644
--- a/doc/define.n
+++ b/doc/define.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: define.n,v 1.1 2008/05/31 11:42:12 dkf Exp $
+'\" RCS: @(#) $Id: define.n,v 1.2 2008/09/23 05:05:47 dkf Exp $
'\"
.so man.macros
.TH define n 0.3 TclOO "TclOO Commands"
@@ -157,6 +157,20 @@ but instead just through the \fBmy\fR command visible in each object's
context) by the class being defined. Note that the methods themselves may be
actually defined by a superclass; subclass unexports override superclass
visibility, and may be overridden by instance unexports.
+.TP
+\fBvariable\fR ?\fIname ...\fR?
+.VS
+This arranges for each of the named variables to be automatically made
+available in the methods, constructor and destructor declared by the class
+being defined. Note that the list of variable names is the whole list of
+variable names for the class. Each variable name must not have any namespace
+separators and must not look like an array access. All variables will be
+actually present in the instance object on which the method is executed. Note
+that the variable lists declared by a superclass or subclass are completely
+disjoint, as are variable lists declared by instances; the list of variable
+names is just for methods (and constructors and destructors) declared by this
+class.
+.VE
.SS "CONFIGURING OBJECTS"
.PP
The following commands are supported in the \fIdefScript\fR for
@@ -233,6 +247,18 @@ This arranges for each of the named methods, \fIname\fR, to be not exported
just through the \fBmy\fR command visible in the object's context) by the
object being defined. Note that the methods themselves may be actually defined
by a class; instance unexports override class visibility.
+.TP
+\fBvariable\fR ?\fIname ...\fR?
+.VS
+This arranges for each of the named variables to be automatically made
+available in the methods declared by the object being defined. Note that the
+list of variable names is the whole list of variable names for the object.
+Each variable name must not have any namespace separators and must not look
+like an array access. All variables will be actually present in the object on
+which the method is executed. Note that the variable lists declared by the
+classes and mixins of which the object is an instance are completely disjoint;
+the list of variable names is just for methods declared by this object.
+.VE
.SH EXAMPLES
This example demonstrates how to use both forms of the \fBoo::define\fR and
\fBoo::objdefine\fR commands (they work in the same way), as well as
diff --git a/doc/info.n b/doc/info.n
index 0a53823..6200357 100644
--- a/doc/info.n
+++ b/doc/info.n
@@ -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: info.n,v 1.27 2008/06/29 22:28:24 dkf Exp $
+'\" RCS: @(#) $Id: info.n,v 1.28 2008/09/23 05:05:47 dkf Exp $
'\"
.so man.macros
.TH info n 8.4 Tcl "Tcl Built-In Commands"
@@ -453,6 +453,13 @@ match\fR.
.VS 8.6
This subcommand returns a list of direct superclasses of class \fIclass\fR in
inheritance precedence order.
+.VE 8.6
+.TP
+\fBinfo class variables\fI class\fR
+.VS 8.6
+This subcommand returns a list of all variables that have been declared for
+the class named \Iclass\fR (i.e. that are automatically present in the
+class's methods, constructor and destructor).
.SS "OBJECT INTROSPECTION"
.PP
The following \fIsubcommand\fR values are supported by \fBinfo object\fR:
@@ -552,12 +559,23 @@ This subcommand returns a list of all classes that have been mixed into the
object named \fIobject\fR.
.VE 8.6
.TP
+\fBinfo object variables\fI object\fR
+.VS 8.6
+This subcommand returns a list of all variables that have been declared for
+the object named \fIobject\fR (i.e. that are automatically present in the
+object's methods).
+.VE 8.6
+.TP
\fBinfo object vars\fI object\fR ?\fIpattern\fR?
.VS 8.6
This subcommand returns a list of all variables in the private namespace of
the object named \fIobject\fR. If the optional \fIpattern\fR argument is
given, it is a filter (in the syntax of a \fBstring match\fR glob pattern)
-that constrains the list of variables returned.
+that constrains the list of variables returned. Note that this is different
+from the lit returned by \fBinfo object variables\fR; that can include
+variables that are currently unset, whereas this can include variables that
+are not automatically included by any of \fIobject\fR's methods (or those of
+its class, superclasses or mixins).
.VE 8.6
.SH EXAMPLES
.PP
@@ -617,7 +635,7 @@ proc getDef {obj method} {
.VE 8.6
.SH "SEE ALSO"
.VS 8.6
-global(n), oo::class(n), oo::object(n), proc(n), self(n)
+global(n), oo::class(n), oo::define(n), oo::object(n), proc(n), self(n)
.VE 8.6
.SH KEYWORDS
command, information, interpreter, introspection, level, namespace,