OTcl
Encyclopedia
OTcl usually refers to an object oriented
Object-oriented programming
Object-oriented programming is a programming paradigm using "objects" – data structures consisting of data fields and methods together with their interactions – to design applications and computer programs. Programming techniques may include features such as data abstraction,...

 extension of Tcl
Tcl
Tcl is a scripting language created by John Ousterhout. Originally "born out of frustration", according to the author, with programmers devising their own languages intended to be embedded into applications, Tcl gained acceptance on its own...

 created by David Wetherall at MIT. It is used in network simulator (NS-2) and usually run under Unix
Unix
Unix is a multitasking, multi-user computer operating system originally developed in 1969 by a group of AT&T employees at Bell Labs, including Ken Thompson, Dennis Ritchie, Brian Kernighan, Douglas McIlroy, and Joe Ossanna...

 environment. This was later extended into XOTcl
XOTcl
XOTcl is an object-oriented extension for the Tool Command Language created by Gustaf Neumann and Uwe Zdun. It is an extension of the MIT OTcl. XOTcl supports metaclasses. Class and method definitions are completely dynamic...

.

OTcl may also refer to the unrelated IXI Object Tcl extension by Dean Sheenan.

These object Tcl extensions predate the more popular incr Tcl.

Syntax Introduction

The reserved word Class is used to represent class and method of class are declared using word instproc. The variable self is pointer to the class it is used in and is equivalent to variable this of C++/Java. The keyword -instproc is used for defining hierarchy. For example Class Son -instproc Father means that class Son inherits from class Father. To create an instance of class son we can write set new_inst [new Son]. Following is a simple example of code.

// Sample code in OTcl
Class HelloWorld
HelloWorld instproc hello {} {
puts "Hello world"
}

set helloworld [new HelloWorld]
//to run
$helloworld hello

TclCL

TclCL (Tcl with classes) is a Tcl/C++
C++
C++ is a statically typed, free-form, multi-paradigm, compiled, general-purpose programming language. It is regarded as an intermediate-level language, as it comprises a combination of both high-level and low-level language features. It was developed by Bjarne Stroustrup starting in 1979 at Bell...

 interface used by Mash, vic, vat, rtp_play, ns
Ns (simulator)
ns is a name for series of discrete event network simulators, specifically ns-1, ns-2 and ns-3...

, and nam. It provides a layer of C++ glue over OTcl.

See also

  • XOTcl
    XOTcl
    XOTcl is an object-oriented extension for the Tool Command Language created by Gustaf Neumann and Uwe Zdun. It is an extension of the MIT OTcl. XOTcl supports metaclasses. Class and method definitions are completely dynamic...

  • incr Tcl
  • Snit
    Snit
    Snit is an object-oriented extension to the Tcl programming language. Snit is a recursive acronym that stands for "Snit's Not Incr Tcl." Snit is a pure Tcl object and megawidget system. It is unique among Tcl object systems in that it is based not on inheritance but on delegation...

  • Tcl
    Tcl
    Tcl is a scripting language created by John Ousterhout. Originally "born out of frustration", according to the author, with programmers devising their own languages intended to be embedded into applications, Tcl gained acceptance on its own...

  • Tcllib
    Tcllib
    Tcllib is a collection of packages available for the Tcl programming language. Tcllib is distributed in both source code as well as pre-compiled binary formats...

  • C++/Tcl
    C++/Tcl
    C++/Tcl is a software programming library interface which allows the integration of C++ into Tcl and vice versa.The C++/Tcl library was inspired by the Boost.Python library and was designed to provide a similar interface....

  • Itk
    Itk
    Itk is a framework for building mega-widgets using the [incr Tcl] object system. Mega-widgets are high-level widgets like a file browser or a tab notebook that act like ordinary Tk widgets but are constructed using Tk widgets as component parts, without having to write C code. In effect, a...

  • Tk
The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK