summaryrefslogtreecommitdiffstats
path: root/doc/upvar.n
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2004-10-27 14:43:54 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2004-10-27 14:43:54 (GMT)
commitc42f7214cddeff6533e5ed52c45ab2c9471382af (patch)
treef9e6f7072c0981606df62c16c7a7d9478dfe2b99 /doc/upvar.n
parentf2710bf0bb0c6ace5d1bc4f424b400537ffdb21c (diff)
downloadtcl-c42f7214cddeff6533e5ed52c45ab2c9471382af.zip
tcl-c42f7214cddeff6533e5ed52c45ab2c9471382af.tar.gz
tcl-c42f7214cddeff6533e5ed52c45ab2c9471382af.tar.bz2
Yet more small fixes
Diffstat (limited to 'doc/upvar.n')
-rw-r--r--doc/upvar.n16
1 files changed, 8 insertions, 8 deletions
diff --git a/doc/upvar.n b/doc/upvar.n
index bb25fee..8cc28a6 100644
--- a/doc/upvar.n
+++ b/doc/upvar.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: upvar.n,v 1.7 2004/05/18 21:29:22 dkf Exp $
+'\" RCS: @(#) $Id: upvar.n,v 1.8 2004/10/27 14:43:54 dkf Exp $
'\"
.so man.macros
.TH upvar n "" Tcl "Tcl Built-In Commands"
@@ -47,8 +47,8 @@ as Tcl procedures.
For example, consider the following procedure:
.CS
\fBproc add2 name {
- upvar $name x
- set x [expr $x+2]
+ \fBupvar\fR $name x
+ set x [expr $x+2]
}\fR
.CE
\fBAdd2\fR is invoked with an argument giving the name of a variable,
@@ -85,18 +85,18 @@ than the name of \fIotherVar\fR. Thus, the output of the following code
will be \fBlocalVar\fR rather than \fBoriginalVar\fR:
.CS
\fBproc traceproc { name index op } {
- puts $name
+ puts $name
}
proc setByUpvar { name value } {
- upvar $name localVar
- set localVar $value
+ \fBupvar\fR $name localVar
+ set localVar $value
}
set originalVar 1
trace variable originalVar w traceproc
setByUpvar originalVar 2
}\fR
.CE
-
+.PP
If \fIotherVar\fR refers to an element of an array, then variable
traces set for the entire array will not be invoked when \fImyVar\fR
is accessed (but traces on the particular element will still be
@@ -108,7 +108,7 @@ A \fBdecr\fR command that works like \fBincr\fR except it subtracts
the value from the variable instead of adding it:
.CS
proc decr {varName {decrement 1}} {
- upvar 1 $varName var
+ \fBupvar\fR 1 $varName var
incr var [expr {-$decrement}]
}
.CE