2 '\" Copyright (c) 1993-1998 Lucent Technologies, Inc.
4 '\" See the file "license.terms" for information on usage and redistribution
5 '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
7 .TH local n "" itcl "[incr\ Tcl]"
10 '\" Note: do not modify the .SH NAME line immediately below!
12 itcl::local \- create an object local to a procedure
14 \fBitcl::local \fIclassName objName\fR ?\fIarg arg ...\fR?
19 The \fBlocal\fR command creates an \fB[incr\ Tcl]\fR object that
20 is local to the current call frame. When the call frame goes away,
21 the object is automatically deleted. This command is useful for
22 creating objects that are local to a procedure.
24 As a side effect, this command creates a variable named
25 "\fBitcl-local-\fIxxx\fR", where \fIxxx\fR is the name of
26 the object that is created. This variable detects when the
27 call frame is destroyed and automatically deletes the
32 In the following example, a simple "counter" object is used
33 within the procedure "test". The counter is created as a
34 local object, so it is automatically deleted each time the
35 procedure exits. The \fBputs\fR statements included in the
36 constructor/destructor show the object coming and going
37 as the procedure is called.
41 private variable count 0
49 method bump {{by 1}} {
59 for {set i 0} {$i < $val} {incr i} {
71 puts "objects: [itcl::find objects *]"
75 class, object, procedure