-IV- Other than C, what languages can talk to tcl/tk?

From: FAQ General information

A. Shell
	There are at least two interfaces which are shell-like.  The
first is wish, which is a windowing shell like interface that is a part
of the Tk package.  The second is tcl, a line command interpreter that
is part of the Extended Tcl package.

B. C++
	Check out tcl++.h in Extended Tcl.  Based on an original
implementation by Parag Patel, it defines a Tcl interpreter class by
which Tcl interpreters can be created as objects under C++.

	Also, ftp://harbor.ecn.purdue.edu/pub/tcl/distrib/tk3.2forC++.patch
is a patch that allows tk 3.2 main.c and other extension routines
to be compiled with a C++ compiler.  Thanks to Ken Yap <ken@syd.dit.csiro.au>
for this code.

	Mark Diekhans and Karl Lehenbauer have used this, in
combination with the handle facility in Extended Tcl, to build Tcl
commands around C++ classes.

	The Tcl handle facility provides a way to manage table entries
that can be referenced by a textual handle from Tcl code.  This is
provided for applications that need to create data structures in one
command, return a reference (i.e. pointer) to that particular data
structure and then access that data structure in other commands.  An
example application is file handles.

	A handle table was built containing pointers to the instances
of a class that were to be accessed from Tcl, say a class `foo_cl', and
then a "new" command defined that created an instance of that class and
returned a Tcl handle to it.  The handle could then passed among Tcl
commands that accessed each member function.  The handle is in effect
an explicit `this' pointer.

	For example:

     set obj [foo_cl::new]
     foo_cl::baz $obj "Hello world"
     foo_cl::delete $obj

It's not totally object-oriented, but it's still very usable.

C. Modula-3
	Norman Ramsey <elan.uucp!nr> says:
	A long time back, Eric Muller posted a Modula-3 interface to
the C Tcl library.  I wrote down a Modula-3/Tcl interface that used
Modula-3 types rather than C types, and that used objects to build
closures for commands.  I wrote part of the implementation but never
finished it.  I have mailed copies to carroll@udel.edu, who asked the
question, and I will post them if there seems to be general interest.

D. Eiffel
	stephan@cs.tu-berlin.de (Stephan Herrmann) says:
	... [the tclish package provides] the marriage of two very different
principles by means of combining two programming languages into a
hybrid program architecture.  

E. Ada
	dennis@dennis.cs.colorado.edu (Dennis Heimbigner) introduced
an adatcl package which gives Ada programmers access to Tcl interpreters.
See the catalog for details of the package.

F. Other

	Duncan Sinclair <sinclair@dcs.gla.ac.uk> has details of a hack
into wish.c some hooks for a Tk <-> any language system, and has been using 
it for communication with functional languages such as Haskell and Lazy ML.
A paper, plus sample code, is available by ftp from
ftp://ftp.dcs.gla.ac.uk/pub/glasgow-fp/authors/Duncan_Sinclair/fumx.* .
Go Back Up

Go To Previous

Go To Next