• Home
  • History
  • Annotate
  • only in this directory
NameDateSize

..14-Nov-2013104

ChangeLogH A D07-Dec-20093.4 KiB

mkpkgidx.tclH A D14-Jan-20044.7 KiB

pkgIndex.tclH A D23-Mar-2007936

READMEH A D27-Nov-20013.1 KiB

stooop.manH A D28-Jan-20097.8 KiB

stooop.tclH A D14-Jan-200438.9 KiB

stooop.testH A D09-Oct-2006249.1 KiB

stooop_man.htmlH A D14-Jan-200460.4 KiB

switched.htmlH A D26-Nov-200111.2 KiB

switched.tclH A D19-Sep-20065 KiB

xifo.tclH A D19-Jul-20043.5 KiB

README

1This is stooop (a Simple Tcl Only Object Oriented Programming scheme)
2version 4.2. Stooop is implemented in a single sourceable file and
3uses simple techniques to provide object orientation to the great Tcl
4language.
5
6If you know C++ or Java, stooop will be easy to use for you. Using the
7familiar class, new, delete and virtual keywords and a few coding
8conventions, you can start object oriented Tcl code right away, as the
9following simple example shows:
10
11
12source stooop.tcl
13namespace import stooop::*
14
15class circle {
16    proc circle {this canvas diameter} {
17        set ($this,diameter) $diameter
18        set ($this,canvas) $canvas
19        set ($this,id) [$canvas create oval 0 0 $diameter $diameter]
20    }
21    proc ~circle {this} {
22        $($this,canvas) delete $($this,id)
23    }
24    proc move {this x y} {
25        $($this,canvas) move $($this,id) $x $y
26    }
27}
28
29pack [canvas .canvas]
30set c [new circle .canvas 50]
31update; after 1000
32circle::move $c 10 10
33update; after 1000
34delete $c
35
36
37Stooop supports single and multiple inheritance, data encapsulation
38(all member data is public), dynamic binding, nested classes, object
39copy, runtime type identification, optional runtime procedure and data
40access checking as well as tracing.
41
42As stooop is entirely written in Tcl, it will run on all Tcl supported
43platforms, including Windows and the Mac Intosh, if you have Tcl
44version 8.3 or above.
45
46The class, new, delete, virtual and classof commands are implemented
47as Tcl procedures.
48
49Stooop was implemented with a constant concern for performance. Member
50data is stored in Tcl associative arrays, which are best for random
51data access. Classes are implemented as namespaces to improve
52encapsulation and reduce naming interferences. Object oriented helper
53code is kept as small and as efficient as possible. Typically, only a
54couple of Tcl lines are added to a member procedure definition.
55Program startup time will be slightly increased due to some class and
56member procedures preprocessing, but runtime overhead is kept to a
57strict minimum. Use of object oriented techniques may actually improve
58the performance of your code.
59
60A full HTML documentation, simple demonstration script, graphical
61demonstration with composite pattern and test files are provided. You
62may also run the test suite and look at the test scripts for
63examples. There is also a utility for creating packages (in the Tcl
64sense) from stooop compatible class files.
65
66There is a companion package to stooop: scwoop (a Simple Composite
67Widget Object Oriented Package). Scwoop is implemented in a single
68sourceable file and uses simple techniques to provide composite widget
69(also known as mega widget) support to the great Tk widget library.
70Moodss (a Modular Object Oriented Dynamic SpreadSheet) implemented
71with stooop, scwoop, tkTable and BLT is also available on my website
72(at http://jfontain.free.fr/).
73
74Whether you like it (or hate it), please let me know. I would like to
75hear about bugs and improvements you would like to see. I will correct
76the bugs quickly, especially if you send me a test script.
77
78Copyright (c) 2001 by Jean-Luc Fontaine <jfontain@free.fr>.
79This code may be distributed under the same terms as Tcl.
80