Friday, August 6, 2010

Java and Tcl

JACL - A Tcl Implementation in Java

One on-going question in the Tcl community is, how can Tcl exploit the popularity of Java and the World
Wide Web. There are two projects that try to bring Tcl into the world of Java and WWW. The Tcl
Plugin [3] allows the execution of Tcl scripts inside Web browsers. However, the Tcl Plugin runs only
inside certain browsers (Navigator and Explorer), requires the user to install software on local machines
and does not communicate well with Java. Tcl-Java [4] allows the evaluation of Tcl code in Java applications, but it requires native methods andthus cannot run inside most browsers.


A Tcl implementation in Java will facilitate the creation of portable Tcl extensions [4]. Tcl is a portable

scripting language. However, although Tcl provides some support for writing portable extensions, maintaining Tcl extensions written in C for multiple platforms is still a difficult task, especially if network or graphics programming is involved. Currently Tcl runs on more platforms than Java. However, due to the large number of commercial Java developers, Java will probably catch up in the near future and run on more platforms. If Tcl implementations can be written in Java, the Tcl community can leave the portability issues to JavaSoft and other Java implementers and concentrate on developing the Tcl core interpreter and extensions.


On the other hand, Java needs a scripting language as powerful as Tcl. Java is a structured programming
language and is not a good scripting or command language [7]. Currently, scripting languages that can
be used on Java platforms, such as Javascript and VBScript, are proprietary, non-portable and restrictive.
Javascript and VBScript run only on the browsers that support them. Their scripting engines are system-dependent and cannot run on arbitrary Java Virtual Machines. These languages are good for scripting HTML pages, but they lack the features that would allow their deployment at any larger scale. For example, Javascript cannot define new classes; Java applets cannot directly pass events to VBScript [5, pp. 843]. Moreover, these scripting languages are not embeddable and thus cannot be used to control Java applic ations.


Jacl is a comprehensive solution to the problem of Tcl and Java integration. Since the Jacl interpreter
and extensions are written completely in Java, they can run inside any JVM, making Tcl an embeddable,
universal scripting language for Java. By using the Jacl interpreter, Java programmers can use Tcl to control simple Web pages, complex networked Java applications, and anything in between.

No comments: