(I don't have the original msg in my mbox, so I'm jumping in here...)


The following is from the Tcl bytecode compiler [1] FAQ:

Why doesn't Tcl use the Java bytecodes?

I [2] had originally hoped to use Java bytecodes because they have a
mature design and because Java is widely available. I chose to use my
own Tcl-specific bytecodes because I was concerned that using the Java
virtual machine would be too slow or take too much memory. The basic
problem is the semantic mismatch between Java bytecodes and Tcl.
Consider the Tcl set command. Tcl variables behave very differently
than Java variables. I can't use a Java instruction like astore (store
object reference in local variable) to store a Tcl value into a Tcl
variable since it doesn't handle by itself such Tcl details as variable
traces, unset, or global. The best I could do would be to translate a
Tcl set command into a sequence of several Java instructions that did
the appropriate checks. Unfortunately, the number of Java instructions
to implement each Tcl command would make the compiled program too big.
A more realistic scheme is to generate Java bytecodes that call one or
more Java methods to do the actual work for each Tcl command. With this
number of Java method calls, acceptable performance will depend on
using a Java JIT (bytecode-to-machine code) compiler. With Java JIT
compilers becoming more widely available this might be realistic. One
possibility would be to translate the relatively high-level Tcl
bytecodes into Java bytecodes. However, there is another problem with
using Java bytecodes. Much of the interesting code in Tcl/Tk and its
extensions is in C. Java code can call native methods implemented in C,
and vice-versa, but this is awkward, not portable, and the capability
is disabled in Netscape (and many other Java implementations) for
safety reasons.

[1] http://www.tcl.tk/doc/compiler.html

[2] Author credit on the document is [EMAIL PROTECTED]



__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com

Reply via email to