Version 0 of How would I reuse my own Tcl code

Updated 1999-06-14 13:02:26

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.
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.
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.
pipe
tcl supports, in the open command, the ability to open an input and/or output pipeline to another process, which is started in a manner similar to the exec command.

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.).