[REBOL] Async API (was: Async call:// protocol v1.0)
From: dockimbel::free::fr at: 19-Feb-2004 15:54
Hi Romano,
You've raised a good point.
I see the 'awake callback as a low-level hook in the event handling process.
As you say, with 'awake you have to make your own internal state-driven
dispatch code (usually calling helper funcs for bigger tasks).
The approach I've used in call:// is just trying to simplify the work for the
developer by hiding the low-level stuff (especially the dispatch code) and
providing just the necessary hooks. These higher-level callbacks are easier to
write (no required return value as in 'awake for ex.) and IMO make the code
more easier to understand.
I think that it's a little similar to View's feelings ('feel object
methods): 'awake is equivalent to the 'detect func and higher callbacks are
close to the code you would wrote in 'engage func. You usually rely on 'engage,
because it's easier and faster to write, and use 'detect for writing special
event handling routines in rare cases where it's necessary.
If the higher-level async callbacks doesn't suit your needs, you're still free
to use 'awake.
I've found 'port/locals/on-my-func1 a little long to write and not very handy.
Maybe this kind of functions should be located in a different 'port word.
(port/call/...?)
-DocKimbel.
Romano Paolo Tenca wrote: