9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* Re: [9fans] Limbo Tk FAQ?
@ 2001-05-25  9:59 rog
  2001-05-25 10:45 ` Lucio De Re
  2001-05-25 14:26 ` Re[2]: " Matt H
  0 siblings, 2 replies; 5+ messages in thread
From: rog @ 2001-05-25  9:59 UTC (permalink / raw)
  To: 9fans

> > graphics programming still
> > reminds me of assembler programming: way too much attention
> > to way too much irrelevant detail.
>
> I'm pleased to discover I am not alone in this, although I couldn't
> have phrased it as succintly or as accurately as you did.  And I
> enjoy assembly programming, but I find graphics programming far
> too tedious.

i think that's because you've got multi-dimensional inputs, often with
associated state, which are much harder to deal with than the
unidimensional, stateless input stream of a command-line program, for
example.

at least with limbo/tk, the language is decently multi-threaded, so
it's often possible to carve a program into logically independent
threads, each of which is quite simple, rather than the age old "one
big state machine" paradigm which is the only way of doing things in
many GUI programming interfaces. despite its superficial simplicity,
i'll bet that Visual Basic falls into that category too.

where GUI programming is inevitably tedious is when you're dealing with
input forms (buttons, entry widgets, sliders, tickboxes, etc, etc), as
there are so many possible states to think about and deal with in the
program. i think that this is going to be the case regardless of
language. the key is probably to minimise (eliminate?) instances of
this kind of interface.

i've found limbo/tk to be a very productive environment, compared to
others i've used (principally the NeXTStep interface (now MacOS X),
which i believe is well regarded).  the first-class strings in limbo
sit very well with the string-based nature of tk. strings nicely
represent a generic tk object.

for instance, the following code animates an arbitrary object smoothly
across a tk canvas at constant velocity. it doesn't matter what the
object is (it might be a composite of many); and there can be any
number of animations happening concurrently.

animproc(a: ref Animation)
{
	SPEED: con 1.5;			# animation speed in pixels/millisec
	dstpt := a.dst.pos.add(a.dst.delta.mul(a.index));
	srcpt := a.srcpt;
	d := dstpt.sub(srcpt);
	if (!d.eq((0, 0))) {
		mag := math->sqrt(real(d.x * d.x + d.y * d.y));
		(vx, vy) := (real d.x / mag, real d.y / mag);
		currpt := a.srcpt;		# current position of object
		t0 := sys->millisec();
		dt := int (mag / SPEED);
		t := 0;
		tk->cmd(win, ".c raise " + a.tag);
		while (t < dt) {
			s := real t * SPEED;
			p := Point(srcpt.x + int (s * vx), srcpt.y + int (s * vy));
			dp := p.sub(currpt);
			tk->cmd(win, ".c move " + a.tag + " " + string dp.x + " " + string dp.y + ";update");
			currpt = p;
			yield();
			t = sys->millisec() - t0;
		}
	}
	a.waitch <-= a;
}

i wouldn't like to do this sort of stuff in tcl.  limbo just makes it
so simple.

that said, i think there is room for some sort of expandability in
limbo/tk, not via tcl, i think but perhaps via some sort of
channel/module/device interface.

i'm sorry, i'm off topic.

  rog.



^ permalink raw reply	[flat|nested] 5+ messages in thread
* Re: [9fans] Limbo Tk FAQ?
@ 2001-05-24 18:50 geoff
  2001-05-25  4:58 ` Lucio De Re
  0 siblings, 1 reply; 5+ messages in thread
From: geoff @ 2001-05-24 18:50 UTC (permalink / raw)
  To: 9fans

The philw put tk into Inferno.  He botched it (of course).
I still haven't seen any reasonably pleasant way to
write GUIs and am becoming convinced that it's just
inherently painful.  limbo/tk is probably less painful
than some other ways, but graphics programming still
reminds me of assembler programming: way too much attention
to way too much irrelevant detail.


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2001-05-25 14:26 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-05-25  9:59 [9fans] Limbo Tk FAQ? rog
2001-05-25 10:45 ` Lucio De Re
2001-05-25 14:26 ` Re[2]: " Matt H
  -- strict thread matches above, loose matches on Subject: below --
2001-05-24 18:50 geoff
2001-05-25  4:58 ` Lucio De Re
2001-05-25  7:44   ` Re[2]: " Matt H
2001-05-25  8:45     ` Lucio De Re
2001-05-25  9:26       ` Re[2]: " Matt H

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).