Incr Tcl

Last updated
Itcl
Tcl.svg
Paradigm multi-paradigm: object-oriented, functional, Imperative, event-driven programming
Designed by Michael McLennan
Developer Michael McLennan
First appeared1993
Stable release
Itcl4.1.1 / 21 December 2017;7 years ago (2017-12-21)
Typing discipline dynamic typing, everything can be treated as a string
License BSD-style
Website itcl at SourceForge
Influenced by
Tcl, C++

incr Tcl (commonly stylised as [incr Tcl], and often abbreviated to itcl) is a set of object-oriented extensions for the Tcl programming language. It is widely used among the Tcl community, and is generally regarded as industrial strength [ citation needed ]. Its name is a pun on "C++". Itcl implementations exist as both a package that may be dynamically loaded by a Tcl application, as well as an independent standalone language with its own interpreter.

Contents

Overview

Features

Namespace support

Itcl allows namespaces to be used for organizing commands and variables.

Example:

packagerequireItcl itcl::classToaster{variablecrumbs0methodtoast{nslices}{if{$crumbs>50}{error"== FIRE! FIRE! =="}setcrumbs[expr$crumbs+4*$nslices]}methodclean{}{setcrumbs0}}itcl::classSmartToaster{inheritToaster methodtoast{nslices}{if{$crumbs>40}{clean}return[chain$nslices]}}settoaster[SmartToaster#auto]$toastertoast2

C code integration

Itcl (like Tcl) has built-in support for the integration of C code into Itcl classes.

See also

References

incr Tcl from the Ground Up by Chad Smith, published in January 2000.

This is a complete reference manual for incr Tcl, covering language fundamentals, OO design issues, overloading, code reuse, multiple inheritance, abstract base classes, and performance issues. Despite its breadth, it follows a tutorial, rather than encyclopedic, approach. This book is out of print as of September 2004.