The hush library is meant to give flexible access to a window programming toolkit and possibly multiple embedded interpreters etcetera. How generic can you become and what is the price you, as a programmer, have to pay for that. in developing hush, we encountered a number of problems and dilemmas, as listed below. One of the recurrent problems, of course, is what is to be considered a basic class/concept and what is merely a derivative of some (already) existing basic class.
event dispatching -- implicit or explicit garbage collection -- ... remote kit -- communication protocol / security multiple kits -- safe, java multiple widget sets -- how to select compound widgets -- component management/configuration handler names -- sufficient for command binding?
client (X) -- to get access to (remote) information protocol (XX) -- defines the protocol of interaction with clients thread (X) -- to allow for multithreadingRemark: X means experimental but realized, XX means very experimental, that is not realized.
The hush library is organized around a limited number of (semi) abstract interface classes and is realized in a corresponding set of implementation classes employing the handle body idiom, virtual self reference and dynamic role switching. The average user however needs to have NO knowledge of any of these techniques. Only a limited number of the subclasses mentioned below are exported. We currently have a discussion whether to export the event subclass hierarchy to export special wrapper classes reflecting the structure of the event hierarchy. The exported classes are indicated with a *, special wrapper classes with a +. Classes decorated with a ? are not or only partially realized. The annotation [kit] indicates the possibility of dynamic role switching, that is the possibility to change the modality of the kit dynamically, for example to choose a different embedded interpreter. The annotation {widget} indicates the possibility of virtual self reference. However in contrast with the kit, a widget cannot change its modality dynamically, that is the widget modality is determined at startup time (by the session) and cannot be changed afterwards.
session* -- tcl_session, python_session?
[kit]* -- tcl_kit, python_kit?, perl_kit?, dlp_kit?, java_kit??
handler* -- widget*, item* (and event, action, kit, session, client ?)
event* -- tcl_event+, file_event+, url_event?, tt_event?
binding* -- tcl_binding, dlp_binding?
{widget}* -- tk_widget, meta_widget?, motif_widget?
item* -- canvas_item, text_item?
client* (X) -- net_client, file_client, (?? url_client ipv net?)
protocol& (XX) -- ??
thread (X) -- ??
Every class in hush is derived from the handler class to allow for access via a script language. However this dominant role of handler may change in the near future.
There are still a number of elements in hush undocumented, such as:
session -- loop, body, ...In addition session is derived from event, event from handler. These issues must become clear. Must we allow users to use hush?<hush/session.h>
kit -- put, get<hush/kit.h>
handler -- dependent, process (dependent handlers)<hush/handler.h>
event -- its relation to discrete event simulation, dependent events action -- ... widget -- default script interface item -- itself client (X) -- ?? protocol (XX) -- the notion doesn't even exist thread (X) -- ?
This item discusses how to realize the class event.
Problem: Simply put the dilemma is whether to have a slim event class and subsequently derived event classes which allows for explicit dispatching on event types and compiler support for operations on events, or a fat event class which necesitates dynamic testing but allows for a general (implicit) dispaqcth procedure.
Background: Discuss pro's and con's.
Pro: compiler support for event operations, named meber function to deal with different events
Con: May need casts when used in implici mode, proliferation of handler methods
Pro: Uniform event handling, allows for arbitrary user extensions, easily documented (at the price of an occasional lie).
Con: need for dynamic checking, need for dispatching on explicit eventclass tag.
The historical background of the incorporation of the sim(1) event class (event(6)). The documentation of resp. event(4) and event(6) proceeds from assumption that the perspective of the programmer sufficiently guides the use of the notion of event.
Solution: Include a _mode variable in handler(4) and allow for testing whether the mode is implicit or explicit.
Realization: In the callback function a test is included for the handler::mode. This is generically built in for each of the (acknowledged) event types.
Discussion: The solution of explicit dispatching is only partial, since Tcl unifies X and (pure) Tcl events. The default is now implicit dispatching.
Problem: Memory leaks, resource management
Background: C++ has no garbage collection, developers are lazy.
Solution: Support for resource management
Realization: The _register function.
Discussion: Is it waterproof?
Problem: We need to integrate multiple embedded interpreters, possibly remote. However, multiple kits may cause instability. See papers/patterns.
Background: Hush supports multiple interpreters. In principle we solve this by eiter role switching or slave interpreters.
Solution:
Realization: Handle/body, dynamic role switching
Discussion: We need to experiment and chat. See examples/hush/tutorial/hush/kit.c and <hush/kit.h>.
Problem:
Background:
Solution:
Realization:
Discussion:
|
Hush Online Technology
hush@cs.vu.nl
09/24/99 |
|
|