IDL language

Simon McVittie simon.mcvittie at collabora.co.uk
Mon May 11 06:36:23 PDT 2009


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Mon, 11 May 2009 at 09:18:12 -0400, David Zeuthen wrote:
> On Mon, 2009-05-11 at 13:06 +0100, Simon McVittie wrote:
> > (I'm assuming you want the generated GLib API to look like GLib, the generated
> > Java API to look like Java, and so on, in terms of how things are
> > capitalized - like dbus-glib and telepathy-glib, and unlike dbus-python.)
> 
> The D-Bus spec says to use CamelCase (actually it says WindowsStyleCaps)
> and the existing message bus and standard interfaces already use that
> naming convention. Would it be a big problem to just add an annotation
> for these corner case, say, 
> 
>  @NamingHint ("Send_DTMF")
>  SendDTMF (int32 stuff, ...)

That's fine for the bits where a convention exists (method names, signal names,
properties) - in Telepathy's XML extensions we use a tp:name-for-bindings
attribute.

(We ended up making our code generation tools fail unless every method, every
signal and every property has this attribute, because we don't want to fall
back to a lossy heuristic and risk having an accidental ABI change when that's
corrected, but that's a per-project policy decision, similar to the choice of
warning flags and -Werror to use for C code - we prefer to err on the side of
being too strict with both.)

However, for the bits where D-Bus core has no convention because it doesn't
have the concept at all (named structs, named enums, named flags, perhaps
names for interfaces) it's not too late to establish a convention that doesn't
have the same problems. Taking an example from Telepathy, there'd be no point
in having something like:

    @NameForBindings("Channel_Details")
    typedef struct { path, DBusQualifiedPropertyValueMap } ChannelDetails;

    @NameForBindings("New_Channels")
    signal NewChannels (array<ChannelDetails> channels);

if you could just declare that struct names are expected to be in Ugly_Case
from the start, and so do this:

    typedef struct { path, DBus_Qualified_Property_Value_Map } Channel_Details;

    @NameForBindings("New_Channels")
    signal NewChannels (array<Channel_Details> channels);

(This matches the Telepathy extensions to introspection XML, in which
method/signal/property names are expected to be in CamelCase, or
"windows-style caps" if you prefer to call it that, with a tp:name-for-bindings
attribute, but types are expected to be in Ugly_Case.)

    S
-----BEGIN PGP SIGNATURE-----

iD8DBQFKCCnNWSc8zVUw7HYRAuOqAKCqs/91MjHhTzSNkbBuo/zFujXrLgCguNfd
K9uZY1drLeon4QsizuAqQjE=
=99K8
-----END PGP SIGNATURE-----


More information about the dbus mailing list