Re: A few comments on GVariant
- From: Danielle Madeley <danielle madeley collabora co uk>
- To: Simon McVittie <simon mcvittie collabora co uk>
- Cc: gtk-devel-list gnome org
- Subject: Re: A few comments on GVariant
- Date: Mon, 07 Dec 2009 11:07:27 +1100
On Mon, 2009-11-30 at 16:38 +0000, Simon McVittie wrote:
> Perhaps it's a sign that I do too much D-Bus, but I find code that uses the
> plain signature strings ("a{sv}") to be much, much more readable than
> DBUS_TYPE_ARRAY DBUS_TYPE_STRUCT_ENTRY_BEGIN DBUS_TYPE_STRING DBUS_TYPE_VARIANT
> DBUS_TYPE_STRUCT_ENTRY_END (or whatever the libdbus constants are really
> called).
>
> The signature characters are all quite mnemonic, apart from the 16- and 64-bit
> integers (I can never remember whether 't' or 'x' is the unsigned one).
I agree that D-Bus style type signatures are much easier to read and
comprehend (in fact, I wish printf used these type names).
As you have already pointed out, Simon, the only use for the #define
names for use with g_print is for platform-varying types like GSize.
Seeing as we don't have compile-time type-safety anyway, for anything, I
think relying on runtime reporting and tests is the best way forward.
Write a comment to explain your complex types [ a{u(ua{sa{sv}})} ].
--
Danielle Madeley
Software Developer, Collabora Ltd. Melbourne, Australia
www.collabora.co.uk
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]