Next: Why Xlib?
Up: Introduction
Previous: Introduction
We have selected Tcl/Tk among several possible candidates
for a GUI toolkit for Prolog.
It was a surprisingly clear winner, for several reasons:
- It provides all basic functionality that is needed
for GUIs.
- It is easy and intuitive to use, it does not
express simple behaviour in complicated terms.
- It is publicly available.
- It is very well written, the code is clean and easy
to understand.
- It provides the necessary functionality but it does not try
to give too much.
Instead, it relies on extensions to provide additional features
on top of the basic toolkit.
Although the extension interface is sometimes not easy to use
and people modify the Tk source code itself, it is still
the right direction.
-
It is one of few platform-independent graphics toolkits, running
on workstations, PCs, and macs.
The X toolkit Tk is itself tightly coupled with the Tcl language,
which has advantages (it provides various mechanisms
not available in Prolog) and disadvantages
(no modularity, the current interpreter is slow), but after all
it is quite natural to use an imperative language to express
the properties of a GUI and Tcl is acceptable for this.
Our Tk interface is quite loose,
we do not map Tk commands to Prolog predicates,
all Tk's functionality is accessed through the Tcl interpreter
(unlike e.g. the Tk interface to Scheme).
There are several reasons why we prefer such a loose interface:
- The interface is simpler, maintenance is easier.
- The interface usually does not have to be modified when
new release of Tcl or Tk comes out
and if so, only changes in one Tk source file have
to be considered.
With a tight interface it is necessary to look at all source
files and check for incompatible changes.
- There is a large number of Tcl/Tk extensions written
completely or partly in Tcl.
If we interface Tk directly, we would have to recode them
or to make a redundant interface to the Tcl interpreter.
- Porting to new machines and operating systems is easier.
- A tighter interface can in fact be written on top of the loose
one, see e.g.
the PAT system.
The ProTcXl interface allows to invoke Tcl commands from Prolog
and vice versa as wella s to handle X11 events in Prolog.
It is usually not necessary to exploit all available Tcl features
when programming GUIs for Prolog, because often
most of the processing is done in Prolog itself.
Sometimes, however, it may be an advantage to separate
different functionalities and to let Tcl execute more complex
operations than just displays.
Next: Why Xlib?
Up: Introduction
Previous: Introduction
Micha Meier
Tue Jul 2 09:49:39 MET DST 1996