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-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
  1 sibling, 0 replies; 5+ messages in thread
From: Lucio De Re @ 2001-05-25 10:45 UTC (permalink / raw)
  To: 9fans

On Fri, May 25, 2001 at 10:59:48AM +0100, rog@vitanuova.com wrote:
> 
> i wouldn't like to do this sort of stuff in tcl.  limbo just makes it
> so simple.
> 
Tcl with channels would do well, too :-)  (Oops, I hope I'm not
speaking through my nose here, I've only given the code a brief
glimpse, looking forward to look at it in more detail later).

> 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 sure I'm sounding like an old hag peddling Tcl, but what appeals
to me about Tcl is that one can construct composite commands, in
effect interpretive language constructs) that more naturally describe
the activities of a user or a class of users of a particular
application.  Tk is very much an example of such an extension, in
this case to Tcl itself, but also to any application that used Tcl
as its command language in the first place.

And adding "filesystems" semantics to Tcl may be an interesting
challenge, too.  It certainly could make very healthy use of the
plumber, in a multi-threaded environment.

As an example (not necessarily a good one) I knocked together a
very small shell to handle a particular aspect of a postgresql
database, using "expect" so that the user could get the benefits
of the Tcl interpreter right at the command line level and still
clean up when they terminated (there may well have been a better
way, but Tcl has grown far beyond its documentation and reading
source is not my idea of keeping up with creeping featurism).

What I was aiming at, though, was the ability to build a few, simple
to use underlying constructs and teach the users how to construct
more complex ones for their purposes, often on the fly.  More
permanent, or often used commands could be included in the prologue,
euither globally or by being included in a particular instance.
In that respect, Tcl is a command line shell, and a very powerful
one, at that.  With default parameters and a sensible prologue and
epilogue, I could provide a secure environment for less savvy, but
trustworthy users.

> i'm sorry, i'm off topic.
> 
We often are, on this mailing list, but the nature of Plan 9 is to
encourage this, not treat it as if it was an unsightly wart.

++L


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

* Re[2]: [9fans] Limbo Tk FAQ?
  2001-05-25  9:59 [9fans] Limbo Tk FAQ? rog
  2001-05-25 10:45 ` Lucio De Re
@ 2001-05-25 14:26 ` Matt H
  1 sibling, 0 replies; 5+ messages in thread
From: Matt H @ 2001-05-25 14:26 UTC (permalink / raw)
  To: rog@vitanuova.com

Hello rog,

>> > 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.

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

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

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

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

rvc> i'm sorry, i'm off topic.
well, while you're there

any idea when signed applets for IE limbo will grace our lives?



-- 
 Matt                          mailto:matt@proweb.co.uk

I'm floating on a lilo in the Sea of Alright




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

* Re[2]: [9fans] Limbo Tk FAQ?
  2001-05-25  8:45     ` Lucio De Re
@ 2001-05-25  9:26       ` Matt H
  0 siblings, 0 replies; 5+ messages in thread
From: Matt H @ 2001-05-25  9:26 UTC (permalink / raw)
  To: Lucio De Re

Hello Lucio,
>The question is: "Is this the answer to Geoff's prayers?"
 It depends if Geoff's prayer is "please can I have a simple
 application framework please"

 It's the IDE that makes the difference.
 VB writes all the form layout files for you. You can write them by
 hand which is probably what tk feels like (which is a guess on my
 part as I've never programmed in it just read various papers)

 
 I found VB's main weaknesses (aside from it's platform dependence) to be it's
 lack of in-built support for things like TCP connections and
 regular expressions and that's what lead to my rediscovery
 of unix like systems.

 that paper is at
  http://www.scriptics.com/people/john.ousterhout/scripting.html

-- 
 Matt                          mailto:matt@proweb.co.uk

I'm floating on a lilo in the Sea of Alright




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

* Re[2]: [9fans] Limbo Tk FAQ?
  2001-05-25  4:58 ` Lucio De Re
@ 2001-05-25  7:44   ` Matt H
  2001-05-25  8:45     ` Lucio De Re
  0 siblings, 1 reply; 5+ messages in thread
From: Matt H @ 2001-05-25  7:44 UTC (permalink / raw)
  To: 9fans

Hello Lucio,

L> I haven't tried VB or VC++, I must confess, perhaps I fear to
L> discover that there are shortcuts out there, as long as you kneel
L> to the right religion.

VB is very easy. Drag & drop controls then double click to get the
wrapper to call it you end up with

Sub Button1.Click()
       Button1.Caption = "I've been clicked"
End Sub

VC++ works in a similar way but is a bit more hairy.

The best way (I think) to work that environment is to make ActiveX
Controls (just a glorified class that has it's own display window)
in VC and then arrange them and make them interact with VB.

Then it's time for battle with MFC. The Microsoft Foundation Classes.
A whole bunch of C++ Classes which prevent portability (even between
types of windows apps) and add plenty of complexity. Chuck in the
many macros for doing window handling and message passing and suddenly
you really don't know what's going on.

-- 
 Matt                          mailto:matt@proweb.co.uk

I'm floating on a lilo in the Sea of Alright




^ 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).