This is stooop (a Simple Tcl Only Object Oriented Programming scheme)
version 2.2.2. Stooop is implemented in a single sourceable file and
uses simple techniques to provide object orientation to the great Tcl
language.

If you know C++, stooop will be easy to use for you. Using the
familiar new, delete and virtual keywords and a few coding
conventions, you can start object oriented Tcl code right away, as the
following simple example shows:


source stooop.tcl

proc circle::circle {this canvas diameter} {
    set circle($this,diameter) $diameter
    set circle($this,canvas) $canvas
    set circle($this,id) [$canvas create oval 0 0 $diameter $diameter]
}

proc circle::~circle {this} {
    $circle($this,canvas) delete $circle($this,id)
}

proc circle::move {this x y} {
    $circle($this,canvas) move $circle($this,id) $x $y
}

pack [canvas .c]
set c [new circle .c 50]
update; after 1000
circle::move $c 10 10
update; after 1000
delete $c


Stooop supports single and multiple inheritance, data encapsulation
(all member data is public), dynamic binding and runtime type
identification. Member data is automatically unset when objects are
deleted.

As stooop is entirely written in Tcl, it will run on all Tcl supported
platforms, including Windows and the Mac Intosh, if you have Tcl
version 7.5. It also works with version 7.4, of course.  Additionally,
stooop is also available as a C dynamically loadable extension for
maximum performance (see the file stooop.c for more information on how
to create the library).

Stooop works be redefining the Tcl proc command, so that object
oriented helper code is added to member procedures. The new, delete,
virtual and classof operators are implemented as Tcl procedures, or
alternatively dynamically loadable as an extension for better
performance.

Stooop was implemented with a constant concern for performance. Member
data is stored in Tcl associative arrays, which are best for random
data access. Object oriented helper code is kept as small and
efficient as possible. Typically, only a couple of Tcl lines are added
to a member procedure definition. Program startup time will be
slightly increased due to proc preprocessing, but runtime overhead is
kept to a minimum. Use of object oriented techniques may actually
improve the performance of your code.

A full HTML documentation, HTML class browser, simple demo script,
graphical demo with composite pattern, test files and manual pages are
provided.  You may also run the test program and look at the test
scripts for examples.

There is now a companion package to stooop: scwoop (a Simple Composite
Widget Object Oriented Package) Scwoop is implemented in a single
sourceable file and uses simple techniques to provide composite widget
(also known as mega widget) support to the great Tk widget library.

Whether you like it (or hate it), please let me know. I would like to
hear about bugs and improvements you would like to see. I will correct
the bugs quickly, especially if you send me a test script.

Jean-Luc Fontaine (mailto:jfontain@apogee-com.fr)


