comp.lang.ada
 help / color / mirror / Atom feed
From: "Warren W. Gay VE3WWG" <ve3wwg@cogeco.ca>
Subject: Re: [OT] Best way to isolate a GUI?
Date: Mon, 17 Feb 2003 12:54:05 -0500
Date: 2003-02-17T12:54:05-05:00	[thread overview]
Message-ID: <3E5121BD.4010200@cogeco.ca> (raw)
In-Reply-To: 3E511C15.1040404@acm.org

Jeffrey Carter wrote:
> Preben Randhol wrote:
>> How do you connect callbacks?
> 
> Callbacks are an excellent example of a tool's limitations affecting the 
> users' way of thinking (everything looking like a nail if you only have 
> a hammer).
> 
...
> If one were to design a windowing system with thinking expanded by the 
> use of a language with high-level concurrency features (like, maybe, 
> Ada?), I can't imagine anyone choosing this design. 

I find that the "callback idea" works ok if you design it in a
clean way (in Ada95 terms). I agree that the C method of hammering
things from void pointers into client data and widget data, is ghastly
at best.  A generic could deal with the client data aspect.

For input and output callback arguments, I use a discriminated record,
which then allows Ada95 checks on record members according to the event
type (ie. the record variation). This is something I wish GtkAda would
use.

> I would think you'd 
> want to associate a concurrent event queue for each window. A task in 
> the application would deal with the events for its window. It could 
> block on the queue to do nothing except respond to events, or it could 
> poll the queue periodically if it has other things to do as well.

This sounds conceptually nice, but it could prove to have practical
problems (I need to think about this more, myself). Thinking in terms
of an X11/MOTIF application, where there can be hundreds of windows within
windows to implement widgets on a form, this translates to hundreds
(if not more) of tasks. This smells a lot like overkill upon first
blush at least.

Additionally, where the application wants access to one event, it would
need to provide an entire task, and then have null handlers for all
the events it was not interested in (I think).  I think I'd need
to prototype this to get a better feel for this.

It might be easier to start with a tagged object, where methods can
be inherited and overriden instead. That way all events can just
do nothing, while you override the events you are interested in.
But this takes us back to a model similar to callbacks anyways, but
instead of registering a callback, you register a tagged record
to receive callbacks.

> While I like many things about GtkAda, one of the things I dislike about 
> it is that it hasn't abstracted away this C feature of the GUI. As a 
> result, it's harder to use tasking with GtkAda than it should be. CLAW 
> and JEWL, for example, have abstracted callbacks away to different 
> extents. JEWL effectively implements the concurrent event queue 
> abstraction on top of Windows.

I can't speak for CLAW, and the one shortcoming I see in JEWL is that
you cannot get "focus events". But the last time I played with GtkAda
I didn't like the callback structures either. They were too prone to
error, because of the data marshalling issues, IIRC.

I would much rather that callbacks used discriminated records that
matched the event type. Then everything compiles well, and is
thoroughly checked, admitedly, some of it at run time. Most of all,
the callback becomes a well documented interface, and is simple to
code for and understand.

-- 
Warren W. Gay VE3WWG
http://home.cogeco.ca/~ve3wwg




  reply	other threads:[~2003-02-17 17:54 UTC|newest]

Thread overview: 57+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-02-16 10:19 [OT] Best way to isolate a GUI? Jano
2003-02-16 14:47 ` Ed Falis
2003-02-16 14:49 ` Victor Porton
2003-02-17 20:52   ` Jano
2003-02-16 16:36 ` Robert C. Leif
2003-02-17  8:44   ` Preben Randhol
2003-02-17 16:22     ` Robert C. Leif
2003-02-17 17:30     ` Jeffrey Carter
2003-02-17 17:54       ` Warren W. Gay VE3WWG [this message]
2003-02-17 19:06         ` Randy Brukardt
2003-02-18  3:15           ` Warren W. Gay VE3WWG
2003-02-18 16:14             ` Robert C. Leif
2003-02-18 18:10             ` Randy Brukardt
2003-02-18 21:12               ` Warren W. Gay VE3WWG
2003-02-18 23:20                 ` Randy Brukardt
2003-02-19 18:28                   ` Warren W. Gay VE3WWG
2003-02-20 19:39                     ` Randy Brukardt
2003-02-20 21:34                       ` Warren W. Gay VE3WWG
2003-02-20  7:50                   ` Dale Stanbrough
2003-02-19 12:49                 ` Marin David Condic
2003-02-19 18:35                   ` [OT] Best way to isolate a GUI? (The final concensous?) Warren W. Gay VE3WWG
2003-02-20 12:40                     ` Marin David Condic
2003-02-20 13:13                       ` Dmitry A. Kazakov
2003-02-20 22:01                       ` Warren W. Gay VE3WWG
2003-02-21  1:25                         ` tmoran
2003-02-21  2:08                         ` Marin David Condic
2003-02-21 17:27                           ` Jeffrey Carter
2003-02-22 14:10                             ` Marin David Condic
2003-02-21 18:02                           ` Warren W. Gay VE3WWG
2003-02-22 14:49                             ` Marin David Condic
2003-02-22 22:50                               ` tmoran
2003-02-23  5:18                               ` Robert C. Leif
2003-02-24 18:06                               ` Warren W. Gay VE3WWG
2003-02-25  1:20                                 ` Robert C. Leif
2003-02-25 17:57                                   ` Warren W. Gay VE3WWG
2003-02-25 12:41                                 ` Marin David Condic
2003-02-25 13:32                                   ` Ole-Hjalmar Kristensen
2003-02-25 17:33                                     ` [OT] Best way to isolate a GUI? (The final fronteer?) Warren W. Gay VE3WWG
2003-02-20  8:26                   ` [OT] Best way to isolate a GUI? tmoran
2003-02-20 12:51                     ` Marin David Condic
2003-02-20 18:47                       ` tmoran
2003-02-17 19:31         ` tmoran
2003-02-18  1:37         ` Jeffrey Carter
2003-02-18  3:39           ` Warren W. Gay VE3WWG
2003-02-18 23:36           ` Randy Brukardt
2003-02-18 13:29         ` Marin David Condic
2003-02-18 18:01           ` Warren W. Gay VE3WWG
2003-02-19 13:06             ` Marin David Condic
2003-02-16 17:25 ` achrist
2003-02-16 21:24 ` Bobby D. Bryant
2003-02-16 21:52 ` David Marceau
2003-02-17  0:57 ` Re; " tmoran
2003-02-17  7:25   ` Jano
2003-02-17 14:09     ` Bobby D. Bryant
2003-02-17 21:12       ` Jano
2003-02-18  7:24         ` Jean-Pierre Rosen
2003-02-18 13:08 ` Marin David Condic
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox