Phil Mercurio

Poet: An OOP Extension to Tcl Supporting Constraints, Persistence, and End-User Modification

Poet (Prototype Object Extension for Tcl) extends the Tcl language with objects featuring dynamic, prototype-based inheritance, persistence, and one-way constraints between object attributes. Poet includes wrappers around the Tk and BWidget widgets automatically generated using introspection. We also describe Poetics (Poet Integrated Construction Set), a sub-project within Poet to create tools to allow a Poet application's code and user interface to be modified by the end-user, from within a running Poet application. The goal of Poetics is to provide some of the functionality of an integrated development environment to the user of a Poet application. An object inspector and code editor are the beginnings of the Poetics toolset.

Poet is an open-source project hosted at


Application developers using dynamic, interpreted languages like Tcl/Tk [1] enjoy access to the command interpreter to inspect and modify the state of running programs, as an aid to testing and debugging, or perhaps even for prototyping new code. They may also choose to make the command interpreter accessible to the user, to enable end-user modification of the program. This is more common if the application is itself a command-line program—-most GUI applications do not expose the command interpreter to the end-user.

Poet (Prototype Object Extension for Tcl) is an attempt to support the development of GUI applications that can be modified by the end-user. We begin by constructing an object system that is fully dynamic and transparent and includes support for persistence. Poet also includes a constraint network that automatically maintains relationships between object attributes. Introspection is used to generate wrappers that define Poet objects for each of the Tk and BWidget widgets, so their attributes can participate in the constraint network.

A set of tools known collectively as Poetics (Poet Integrated Construction Set) support end-user inspection and modification of a running application. The primary tool is an object browser that displays an object's attributes (called slots), methods, constraints, and relationships to other objects. Poetics also employs Poet's optional type system so that appropriate content-specific editors can be used to edit slot values. A syntax-highlighting code editor allows an application's source code to be edited, saved, and reloaded in a running application.