X & Self

R James Noble kjx at comp.vuw.ac.nz
Fri Nov 30 04:25:46 UTC 1990

Some more random thoughts generally in response to recent messages by
trot%reed.BITNET, Sean Levy and Craig Chambers.

My current thinking is also that writing an Xlib in Self (using TCP,
not linking in the C Xlib) is probably the way to go. There may be a
bit more work, and a loss of speed, but a great gain in style :-).
I don't like Xt and would hate it to become the defacto Self windowing
toolkit. In a real OO language we should be able to do much better.
I like Sean's idea of object-based interfaces but it seems better to
have the objects in the same world - everything done in Self, in other
words. This makes things easier when you need two-way communication,
or when the graphics object needs to query the Self object world.

The other advantage of a UI server would be display system
independence. If we want to keep as much in Self as possible, we could
define a Self Graphics & Interaction Model (SWIM, pun intended) which
could then talk to X, SunView, XGL, (or even a UI server). This could
be a standard specification to which interface objects would have to
adhere, or we could have SGIM objects which would know how to talk to
the individual graphics systems. 

Regarding X again, at the low level I suppose you could just have a
connection object to handle the TCP stream, doing all the conversions
(I'd put buffering here too), and each protocol request would just be
a message to this object - rather than each object knowing how to
send particular requests out the wire. So a window might respond to 
	w lineFrom: 5 at 5 To: 10 at 10 GC: fooGC 
by sending 
	connection drawLineDrawable: w GC: fooGC From: 5 at 5 To: 10 at 10
to the connection, rather than stuffing the bytes itself. (And I
suppose with inline set appropriately, we wouldn't even take a
performance hit).

Regarding the namespace, ("x display clone" vs "display clone" vs
"xdisplay clone"), we've got multiple inheritance so objects
interested in X can inherit from an X namespace object. Thus, most
objects using X can access it without prefixes, while not intruding
much into the system namespace. 

I would make my window objects have their display & superwindow as
slots, I built a minimal X toolkit and this seems a good idea, I'd
probably add default GC's as well. (But this depends on how much of a
"toolkit" the interface is to be).

Finally, on another note, I am considering doing a bit of Self hacking
(as Self has reached the top of my ToDo list, but I'd like a bit more
practice before starting on X :-).  I will probably try a set of Stream
objects based upon the design of the Smalltalk classes, unless this
seems a bad idea, or somebody already has some. 


R James Noble, Graduate Student, Computer Science Department
Victoria University, Box 600, Wellington 1, New Zealand
kjx at comp.vuw.ac.nz 
1. mail self-interest 2. receive 1000 mailer errors.

More information about the Self-interest mailing list