[ENH] OS-level events

David M.Siegel dsiegel at mindspring.com
Thu Jul 1 04:07:13 UTC 1999



Peter Smet wrote:

> My understanding of events is much more basic than the others discussing
> this issue, but I have a naive question.
>
> Why are low level OS events like mouse clicks and keyboard strokes treated
> differently from a general events mechanism? By this I mean a mechanism for
> passing messages to 'subscribers' whenever an object emits an event
> (publish-subscribe)? It seems to me that any event still has an Object from
> which it originates, and one or more objects that will be told the event has
> occurred. Why can't low and high level events share the same abstractions,
> and even be placed on the same event queue? I also think exception-handling
> has much in common with event handling (on: exception do: aBlock). The
> exception looks to me very much like an 'event' that the block is told
> about. Is it possible to fuse these three mechanisms into a common
> abstraction and reuse a lot of the code, or is this just wishful thinking on
> my part?

I'm afraid it's wishful thinking.

Events are delivered asynchronously. The event generating process is normally
not the one that receives the event.

Exceptions should be delivered synchronously, to the same process that raised
the exception, with access to the context at the point where the exception was
raised.

Updates (subscriptions) could be delivered asynchronously, but that's not the
Smalltalk tradition. Quite a bit of Smalltalk code assumes that updates are
handled immediately after they're generated, before the generator executes
the next line of code.





More information about the Squeak-dev mailing list