2012-03-31

signals are another dimension of interfaces

3.5: adda/cstr/signals/another dimension of interfaces:
. pyqt's connector lets an object's method
emit a message to a notification center,
which then relays the signal by launching an instance of
"(on signal do call this list of functions
which can include emitting an object's signal;
use qobject`connect to add to the todo list
of a signal of some object ).
. signals are like gui's mousedown(coords) event,
which means it emits a signal to the eventqueue,
and you can respond to events by connecting the signal
to your subprogram named:
[what I do when a mousedown happens].
this works like a framework class
where it has methods for you to define
so it knows what to do for you .
. they are a new control system
more similar to exceptions than to object functions .
in fact an exception is a special kind of signal
just as a task type is a special kind of datatype .
. I like to think of object communications in human terms
like telephones and mailboxes;
emitting a signal is like publishing a newsletter;
people can subscribe to your newsletter
by naming a mailbox .
. then that address will be just for that newsletter,
and you have one of your staff there (a subprogram)
waiting to respond to what that newsletter says .
. this responder subprogram is called a slot .
. a list of publishings can be seen as a
dimension of a type's interface
except that rather than being a type member's requirement,
it explains what is expected of clients of the type's members;
ie, part of the type's service is
keeping you uptodate with these newsletters .

3.23: adda/cstr/unify exceptions, dialogs, and signals:
. a dialog is like a gui dialog:
the caller provides a callback
and if the callback comes back before a timeout error
then the server continues
else it does a dialog-failed exception .
. the exception works like ada's:
it signals a failure (type, details), and then terminates .
so the block's exception catching part
should look like the signal catcher parts :
they are both interrupt handlers .

1 comment:

  1. "( in fact an exception is a special kind of signal
    just as a task type is a special kind of datatype .)
    -- it's actually a control type:
    a call means get service from a process
    rather than activate a subprogram .

    ReplyDelete