[Telepathy] telepathy-glib: TpConnectionManager::protocols is awkward
dafydd.harries at collabora.co.uk
Tue Oct 14 11:19:44 PDT 2008
Ar 14/10/2008 am 17:23, ysgrifennodd Murray Cumming:
> On Tue, 2008-10-14 at 13:02 +0100, Will Thompson wrote:
> > Given that using any D-Bus API inevitably entails using asynchronous
> > method calls, I don't see why it's so bad that the ConnectionManager
> > proxy object's introspection is asynchronous.
> The use of D-Bus is implementation and there's no reason to expose that
> implementation in (meant to be) higher-level API such as telepathy-glib.
I think that hiding the asynchronous nature of the introspection does a
disservice to the user of the API. Users of Telepathy GLib have to understand
asynchronous operations in order to be able to use it effectively. The API has
to be asynchronous because (a) D-Bus operations are inherently unbounded in
execution time and (b) it avoids the dedlocks inherent in synchronous
operations. Making introspection synchronous would be to pretend that it's
somehow different from other Telepathy operations.
I agree that asynchronous APIs are harder to use than synchronous ones, but I
think that a lot of this comes down to shortcomings of C (lack of
closures/anonymous functions/garbage collection). At least, if there is a
nicer way to do async operations in C than that provided by Telepathy GLib
then I don't know what it is. Unfortunately, correctness compels us to
make our APIs asynchronous, even though it is at a cost of usability.
I basically agree with Havoc's argument that IO should be asynchronous by
default (and IO includes D-Bus).
More information about the Telepathy