Purpose: describe the various methods available within Tcl for code reuse. Cut/copy and paste: user maintains a series of text files containing tcl code and then just copies the text when needed. source: tcl has a command called '''source''' which reads a file, treating the contents just as if they were a part of the original file. load: tcl has a command called '''load''' which is used to attach a dynamically loadable object extension to the current library. packages: See Will Duquette's "Guide to Success with Namespaces and Packages" at http://www.wjduquette.com/tcl/namespaces.html . unknown: tcl has a command called '''unknown''' which is invoked whenever the tcl interpreter is unable to determine a particular command. unknown does some processing and can provide dynamic sourcing of functions. Details go here. See [Radical Language Modification] for examples how to deal with the unknown. exec: '''exec''' is a tcl command used to invoke a stand alone command. This command can be written in any language supported by the system. [Cameron Laird] wrote a nice explanation of some of the common questions about exec on comp.lang.tcl a while ago - see http://x8.dejanews.com/getdoc.xp?AN=389920667 for the article. This is one of the most common ways people set up Tcl commands to run non-Tcl commands. pipe: tcl supports, in the '''open''' command, the ability to invoke a stand alone command, opening an input and/or output pipeline to it. It is started in a manner similar to the exec command. This is one means used to write a tk interface to 'wrap' around an existing program. proc: tcl of course supports the ability to write functions, which is a mechanism many languages provide for writing code once and then calling it multiple times. expect: the [Expect] extension/program is a Tcl package designed to write 'wrappers' around existing tcl or non-tcl programs. It is a method common to the exec above, but with extensions designed to make interacting with character based applications easier. ---- Be sure to read [Concepts of Architectural Design for Tcl Applications] for a great article on this topic. I hope people stopping by this page will update the above descriptions to fill in a lot of the details (where does pkgIndex, tclIndex come in - what other options are available, etc.). <> Tutorial