| Procedures |
|
|
At first glance, Tcl procedures are pretty standard. Procedure invocations have arguments that match up with parameters declared in procedure implementations. Namespaces for variables are different when procedures are executing than before they are invoked. Such local variable namespaces are destroyed when their procedures finish executing. Namespaces for procedures, on the other hand, are global. A procedure named p can be referenced anyplace that the same Tcl interpreter controls. (There is one exception to this described below in Action Families.) Beyond these common features, Tcl procedures have their own peculiarities. They can be reimplemented on the fly. The way they access and manipulate values of nonlocal variables is unique. These are topics you must master before you can program well in Tcl. However, idiomatic Tcl/Tk programming involves more, it involves the way you fit multiple actions into single procedures. That topic, too, is covered in this chapter your more complex scripts should take advantage of it. Procedures are so important and the nuances of using them are so many that the discussion of them continues with Chapter 9 and briefly with Section 5.7.
|
Author's Home Page |
|
Order from Amazon. |