Hosted by |
|
Thread Safety | Internationalization | Regular Expressions | TEA | Message Catalog | DDE | Byte Code Compiler | Dual-Ported Values | Native Look and Feel Tcl has seen major improvements in the last few releases. The result is a high-performance, cross-platform scripting language with a robust, thread-safe implementation. For more detailed information about the new features in each version of Tcl/Tk, take a look at the Release Notes.
Support for Multi-Threaded ApplicationsWith the Tcl/Tk support for thread safety, developers can now use Tcl in multi-threaded, high performance applications. Finally, all the benefits of scripting - rapid development, extensibility, powerful GUIs, and more - can be applied to multi-threaded applications. Individual threads are allowed to use one or more interpreters as long as each interpreter (and any slave interpreters) is only accessed by one thread. Interpreters in different threads communicate by sending Tcl scripts to other threads for evaluation. There are new C APIs for mutexes, condition variables, and thread local storage. InternationalizationTcl's new internationalization facilities allow developers to create Tcl applications that support any multi-byte language, including Chinese and Japanese. Tcl is the first cross-platform scripting language to help developers to deploy both commercial and enterprise network applications on a global scale. Tk has also undergone a major overhaul to support the new internationalization features of Tcl. The font package has been rewritten to support arbitrary Unicode characters; when you specify a particular font such as "Times 12", Tk may actually use additional fonts to display Unicode characters that don't exist in the font you chose. Tk guarantees to find a way to display any Unicode character regardless of the font you selected, as long as there is some font in the system that contains the Unicode character. The input method support in Tk has also been modified to support full Unicode characters. Advanced Regular ExpressionsTcl features an all-new regular expression package developed by Henry Spencer, the world renowned expert on regular expressions. The two major additions are Unicode support, so you can process text from any language with regular expressions, and Advanced Regular Expressions (AREs). These features make Tcl regular expressions the best available today.Tcl Extension Architecture (TEA)It has always been easy to extend Tcl with new commands. However, lack of makefile standards and differences in dynamic loading facilities have made it difficult to share extensions, either as source code or binary distributions. The Tcl Extension Architecture (TEA) provides standards for extension writers so all Tcl extensions can be built in a common framework, and easily shared by others in the Tcl community. Tcl uses autoconf, configure, and make for its build process on both Unix and Windows. TEA includes a set of standard autoconf macros that extension authors can use to create their own highly portable extensions. There are also sample project files for the Macintosh and Windows compilers. Tcl implements its own form of dynamic linking through a "stub library" mechanism. An extension that links against the stub library can be used across multiple versions of Tcl. It is also possible to create statically linked Tcl shells that can still dynamically load extensions linked against the stub library. Other Improvements Introduced in Tcl 8.1Message catalogThere is a new message catalog package which makes it easy to localize the strings in a script. DDE supportA DDE package has been added for the Windows platform. This allows Tcl applications to use DDE to communicate with other Windows applications. This package is not yet a complete replacement for the Tk send command. Note that this package is usable from Tcl shells. Configuration optionsThere is a new library of C procedures for manipulating widget configuration options using Tcl_Objs instead of strings. This should eventually make Tk much more efficient. Label, button, checkbutton, radiobutton, and menu widgets have been modified to use the new library. More Tcl_Obj supportSeveral additional C library procedures have been added to support Tcl_Objs. Tk embeddingTk embedding now also works on the Macintosh, as long as both the container and embedded application are in the same process. Binary dataBinary data is handled differently since Tcl 8.1 than in Tcl 8.0. Tcl now uses the UTF-8 facilities to represent binary data: the character value zero is represented with a multi-byte sequence, so that (once again) strings in Tcl never contain null bytes. This means that binary data is now accepted everywhere in Tcl and Tk (in Tcl 8.0 the support for binary data was incomplete). If you have C code that needs to manipulate the bytes of binary data (as opposed to just passing the data through) you should use a new object type called "byte array". · Byte Code CompilerTcl 8.0 introduced a byte-code compiler for Tcl. The compiler works transparently, automatically compiling code the first time it is executed. Performance improvements can be large for specific operations, especially list operations. Execution speed for a whole application is generally about twice as fast as earlier versions of Tcl.
Dual Ported ValuesTcl 8.0 also introduced a new data type,Tcl_Obj to replace
the use of simple strings in the Tcl command interface.
This dual ported value stores both a string representation of a value
as well as a native representation such as a 32-bit integer,
a double-precision floating point number, a Tcl list, binary data,
or Tcl byte codes.
Tcl automatically manages these values so their type is transparent to
the Tcl script writer. However,
conversions between strings and native representations is done in a lazy manner,
so the Tcl C library is able to avoid the cost of string conversions.
Tcl still supports the string-based interface to Tcl command implementations.
However, commands that use the Native Look and FeelTcl 8.0 improved the cross-platform features of the Tk GUI toolkit so it honors the native look and feel of Unix, Windows, and Macintosh as much as possible. The same Tcl/Tk script will have a different appearance and default widget bindings depending on the current platform. Platform-independent font names were introduced so you can name fonts with names like "times 10 bold" instead of the complex X logical font descriptors. Tk is also able to do automatic font substitution when you use platform-independent font names.
|