The Tcl Compiler

The Tcl Compiler is an on-the-fly compiler that is virtually transparent to Tcl scripts. The compiler translates a script to byte codes the first time it evaluates it. If the script is evaluated again, such as in a loop or in a procedure body, then the byte codes are executed and the translation step is saved. If a procedure is redefined, then the compiler discards any translated byte codes for it.

The compiler uses a dual-ported object model instead of the simple string-based model used in earlier versions of Tcl. The dual-ported objects hold a string value and a native representation of that string such as an integer, double-precision floating point value, or compiler byte codes. This makes it possible to save translations ...

Get Practical Programming in Tcl & Tk, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.