TOE

Home page: [L1 ]

Toe is an extension to the Tcl programming language that enables object-oriented (OO) programming in a class-based, Java-like style. Toe provides commands that allow a Tcl scripting programmer to create OO classes, define functional relationships between classes, run Tcl code in objects created from the classes, and implement various multiple-class patterns that are well-known in the object-oriented paradigm.

The primary purposes of Toe are:

  1. to provide a complete and integrated body of functionality for rich OO programming in a style that approximates what Java and C++ offer,
  2. to enable an uncoupling of software design and implementation in Tcl, and
  3. to leverage the Tcl/Tk environment as much as possible.

The distinctive features of Toe to Tcl users include object ownership and lifetime management, interfaces as sets of method declarations, and a framework-enabling abstraction mechanism for calling methods in a derived class from a method in the base class. In combination with classes themselves, these features facilitate the implementation of many design patterns in Tcl.

The programming model for Toe is similar to that for the Java and C++ programming languages. In Toe, a class is provided as an essentially complete specification of behavior and data to be instantiated as one or more objects, in which the values of class variables become unique to that object.

Compared to other OO systems on the Tcl platform, Toe shares many features, but differs in its foundation. Toe maintains an internal representation for each class specification, and integrates a class with other components to instantiate an object. Toe provides a partially exposed "runtime" for managing classes and objects, and for supporting introspection. Toe also provides a unique, "common" object for each class solely to contain the data and methods that are declared "common," akin to "static" in Java or C++. Toe allows, but does not encourage, the modification of instantiated objects. Toe also extends the use of Java-like interfaces, in that a class in Toe can either implement or abstract an interface containing method declarations. (see comparison chart)

If you are comfortable programming in Tcl, but would like to realize the benefits of OO programming in the class-based style of other popular OO languages, then Toe may be your easiest option. If, for professional or personal reasons, you program in multiple languages, and Java, C++, or Objective-C are among those languages, then you may find that Toe enables you to use your OO knowledge base for programming in like manner in a Tcl environment.