TOC PREV NEXT INDEX

 


What Is and Isn't Compiled


TclPro Compiler will compile most of the Tcl code in your applications, but it can't compile absolutely every Tcl command. Where TclPro Compiler cannot compile a command it leaves it in text form where it will be compiled at runtime when the command is invoked. Your bytecode files will still execute correctly even if some commands aren't compiled, but uncompiled commands mean that part of your source is more easily accessible to your users. This section discusses what TclPro Compiler can and cannot compile.

When it compiles a script, TclPro Compiler divides the script up into its component Tcl commands and compiles each one. If TclPro Compiler can determine that the argument to a command is a Tcl script, then it compiles that script also. However, if TclPro Compiler can't determine that an argument is a script, then it leaves that argument as a string. For example, TclPro Compiler can identify all the Tcl scripts used as arguments to standard Tcl commands, such as the bodies of if, while, and proc commands. However, in the following script TclPro Compiler can't tell that the argument to the do10 procedure is a script:


proc do10 {script} {
    for {set i 1} {$i <= 10} {incr i} {
        eval $script
    }
}
do10 {puts "hello"}

In general, if you write a procedure that takes a script as an argument, TclPro Compiler can't tell that the argument is a script, rather than, say, an ordinary string value, so it can't compile that argument. Again, the bytecode file will behave correctly; the unknown argument will be compiled when it is actually executed.

TclPro Compiler has these limitations:

The following example illustrates the constraints with procedures and namespaces.




http://www.ajubasolutions.com
Voice: (650) 210-0100
Fax: (650) 210-0101
support@ajubasolutions.com
TOC PREV NEXT INDEX