Jun 222012
 

This article provides an update on the Tcl scripting language and its associated toolkit, Tk. Scripting languages are designed to glue components together. They work with system programming languages such as C or Java, which are good languages for building components. Other popular scripting languages include Perl, Visual Basic, JavaScript, Python, and UNIX shells such as sh.

Scripting languages have existed for several decades, but their popularity has risen dramatically over the last 10 to 15 years. This is due in part to improvements in scripting technology but is mostly due to changes in the application mix. New application domains such as graphical user interfaces and enterprise applications have a strong gluing flavor that makes them ideally suited to scripting languages.

Tcl has two properties that make it a good choice for scripting. First, it is embeddable: its interpreter is a C-library package that can be linked into applications easily. This allows Tcl to be used for a variety of purposes, ranging from testing to CAD to Internet commerce. Second, Tcl is extensible: it is easy to build in new components C or C++ and make them available for scripting via Tcl. One popular extension is Tk, which provides facilities for creating GUIs. With Tcl and Tk, many people have reported a 5x to 10x reduction in development time for GUI applications, compared with toolkits based around traditional 3GLs such as C and C++.

I wrote the initial versions of Tcl and Tk at the University of California at Berkeley and began distributing them freely on the Internet. When I moved to Sun Microsystems in 1994, I brought Tcl and Tk with me. We now have a team of about a dozen engineers, called SunScript, driving the development of Tcl and Tk.

Recent Developments

With Sun’s support, Tcl and Tk have improved in many ways. They have been ported from their original UNIX base to run on PCs and Macintoshes. Tcl and Tk now provide one of the best cross-platform development environments in existence: you can write a Tcl/Tk script that will run on any platform and display itself using the native look and feel of that platform. Tcl 8.0 (the most recent release) includes a bytecode compiler that speeds up Tcl scripts by a factor of 2 to 20 (depending on the application), and Tk 8.0 has new and improved font and menu mechanisms. We have given Tcl an event-driven 1/0 system and added simple but powerful support for Internet sockets: you now can build a Web server with just a few hundred lines of Tcl code. We have implemented a security model called Safe-Tcl that lets Tcl scripts be sent across the Internet and executed without fear of viruses. We also have created a plug-in for Netscape Navigator and Microsoft Internet Explorer that enables Tcl/Tk applications to be delivered via the Web (using Safe-Tcl, of course).

Use of Tcl and Tk has grown rapidly since the first release in 1990. Today, 5,000 to 8,000 downloads of Tcl occur each week from the SunScript Web site, three times more downloads than last year at this time. We estimate the total worldwide Tcl/Tk community to be around 500,000 developers.

Numerous free extensions are available for Tcl, including BLT (which provides additional graphing functions), incr tcl (which provides object-oriented programming features), Subtcl and Oratcl (which provide access to popular database-management systems), and Scotty (which interfaces Tcl to SNMP).

Coming Soon

We are continuing to enhance Tcl at Sun and have several projects underway. The first is integrating Tcl and Th. with Java. It soon will be possible to build Tcl extensions in Java and to use Tcl as a scripting language in Java applications. These facilities take advantage of the new native method and reflection interfaces in JDK 1.1. We also are working on internationalization facilities for Tcl, based on the UTF-8 variant of Unicode. This will make it easy for Tcl applications to deal with a variety of character-set encodings. Finally, we will be providing simple Tk interfaces to key component architectures such as ActiveX and Java Beans; this will provide Tcl programmers an even larger set of components to use in their applications. We expect to release early versions of the Java support and internationalization shortly, with ActiveX and Java Beans support following in 1998.

People often ask me about the relationship between Tcl and Java: aren’t these languages competitive, and doesn’t Java make Tcl obsolete? Just the opposite is true. Java and Tcl are naturally symbiotic. Java is an excellent system-programming language, ideal for creating Internet-ready components. However, it needs a companion scripting language to glue those components together, and the scripting language must have the same security and cross-platform properties that Java has. Tcl meets both requirements. Tcl has always worked with system-programming languages. Until recently, C and C++ have been the primary languages used for creating Tcl components. However, as Tcl moves to the Internet, it needs a better component language. C and C++ do not have the right portability and security properties, but Java does. In the future, I expect to see Tcl and Java working together in the same way Tcl and C have complemented each other in the past.

 

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)