Home

TclOO

TclOO is the object-oriented extension for the Tcl programming language, providing a class-based object system that is integrated into modern Tcl distributions. It offers a lightweight, Tcl-friendly approach to defining classes, creating objects, and invoking methods, and is intended as a practical alternative to older Itcl-style OO within Tcl.

Core concepts in TclOO include classes, objects, methods, and constructors. A class defines a set of behaviors

Inheritance and composition are supported through single inheritance and mixins, enabling a class to reuse and

Usage of TclOO typically involves defining a class with a dedicated class-creation facility and then instantiating

See also: incr Tcl (Itcl), Tcl, Tk, object-oriented programming concepts in Tcl.

(methods)
and
a
per-object
state
(attributes
or
fields),
while
an
object
is
an
instance
of
a
class.
Methods
are
called
on
objects
and
can
access
or
modify
the
object’s
state
via
a
special
reference
to
the
current
instance.
Constructors
initialize
new
objects,
and
many
implementations
also
provide
a
destructor
or
finalization
hook
for
cleanup.
extend
behavior
from
one
or
more
parent
sources.
Method
resolution
follows
a
defined
order
that
respects
overrides
in
subclasses
while
preserving
access
to
parent
implementations
when
needed.
objects
from
that
class.
The
system
works
within
Tcl’s
namespaces
and
is
designed
to
be
interoperable
with
other
Tcl
packages
and
toolkits,
such
as
Tk
for
graphical
interfaces.
TclOO
is
well-suited
for
modeling
widgets,
services,
and
configuration
objects
within
Tcl
applications,
and
it
is
part
of
the
standard
Tcl
ecosystem
in
recent
releases.