This is stooop (a Simple Tcl Only Object Oriented Programming scheme)
version 3.7. 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++ or Java, stooop will be easy to use for you. Using the
familiar class, 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
namespace import stooop::*

class circle {
    proc 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 {this} {
        $circle::($this,canvas) delete $circle::($this,id)
    }
    proc move {this x y} {
        $circle::($this,canvas) move $circle::($this,id) $x $y
    }
}

pack [canvas .canvas]
set c [new circle .canvas 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, nested classes, object
copy, runtime type identification, optional runtime procedure and data
access checking as well as tracing.

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 8.0 or 8.1.

The class, new, delete, virtual and classof commands are implemented
as Tcl procedures.

Stooop was implemented with a constant concern for performance. Member
data is stored in Tcl associative arrays, which are best for random
data access. Classes are implemented as namespaces to improve
encapsulation and reduce naming interferences. Object oriented helper
code is kept as small and as 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
some class and member procedures preprocessing, but runtime overhead
is kept to a strict minimum. Use of object oriented techniques may
actually improve the performance of your code.

A full HTML documentation, simple demonstration script, graphical
demonstration with composite pattern and test files are provided. You
may also run the test suite and look at the test scripts for
examples. There is also a utility for creating packages (in the Tcl
sense) from stooop compatible class files.

There is 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,
and is compatible with the Tcl web browser plug-in. Moodss (a Modular
Object Oriented Dynamic SpreadSheet) implemented with stooop, scwoop,
tkTable and BLT is also available on my website.

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
http://www.mygale.org/~jfontain/ or mailto:jfontain@mygale.org
