incr Tcl

[incr Tcl] is an OO system for Tcl. The name is a play on C++, and [incr Tcl] provides a similar object model, including multiple inheritance, and public and private classes and variables. The name is often written as “itcl” as that contains no metacharacters (i.e., space or brackets).

See Also

Tcl++
A pure Tcl implementation of incr Tcl
wigwam
dresses up Tk widgets as incr Tcl classes

Documentation

official reference
incr Tk/itk and incr Widgets/iwidgets
Incr Tcl Design Patterns
BOOK Tcl/Tk Tools
contains an out of date tutorial for itcl
BOOK incr Tcl from the Ground Up

Download

[incr Tcl] is a component of some batteries included Tcl distributions, such as Tcl Dev Kit, ActiveTcl, Tclkit and dqkit.

JTcl/Jacl Port

[incr Tcl] was ported to the JTcl Interpreter and Jacl by Mo DeJong, and is included in those intepreters.

Widget Sets

[incr Tcl] is also the foundation of [incr Tk] and the Iwidgets megawidgets. The home page is http://incrtcl.sourceforge.net/itcl/ , and source code is available at http://sourceforge.net/projects/incrtcl

Script level commands in the itcl extension

Why use itcl?

Marty Backe posted an apt testimonial to comp.lang.tcl: "I've been using Iwidgets for awhile now, and recently completed a project that was fully implemented in itcl (including Iwidgets). I'm converted. Once you write a program based on objects, you might be hard pressed to go back to the straight tcl way. It becomes VERY easy to write clear, concise code. Of course you can do the same with namespaces (that's what I've been doing), but it takes a lot more work, and the result isn't as satisfying (IMHO).

My current approach is to have one file that contains the main application, which primarily creates objects via class files sourced from a class/ directory. Each object is defined in one class file. This facilitates testing of the objects prior to integration into the application.

Add on classes for incr tcl

Debugging

See Itcl trace.

History

Between 1995 and 2008 there were over a dozen OO extensions for Tcl: [incr Tcl] eventually won as the community recognised that the consolidating OO systems would permit the community to focus energies and gain strength.

From Tcl 8.5 itcl was revamped in an initiative called itcl-ng using the tclOO mechanisms; this formed the basis for the version of itcl that is integrated with Tcl 8.6. This is detail as it maintains the same itcl programmer interface.

LV: In Dec, 2008, on comp.lang.tcl, it was announced that TIP #50 [L1 ] had finally been realized, with itcl 4.0 being merged into the Tcl 8.6 source tree.

apw 2008-12-20: for a feature list of itcl 4.0 (called also itcl-ng) see: [L2 ]. There are a lot of new features like delegation, components, types, widgetadaptors, widgets etc.

FPX 2008-03-06: Yes. [incr Tcl] is very stable and robust, and it is still actively maintained to work with the latest versions of Tcl. Its Web presence may not always be up to date, but the code base in CVS is.

FPX 2008-03-06: [incr Tcl] 3.4 is required with Tcl 8.5 and later.

more about history here, if you please.

LV: Actually, itcl-ng (aka incr tcl 4.0) is required with Tcl 8.5 and later.

Caveats to this page

This page deliberately simplifies the status of itcl, the fact that it was separate to tcl, and how it won over the other object systems.

Bugs

AMG, 2014 April 08: [incr Tcl] dies with SIGSEGV in at least one case where a private method is invoked [L3 ].