IDL language

David Zeuthen david at fubar.dk
Mon May 11 06:18:12 PDT 2009


On Mon, 2009-05-11 at 13:06 +0100, Simon McVittie wrote:
> On Fri, 08 May 2009 at 12:45:50 -0400, David Zeuthen wrote:
> > On Fri, 2009-05-08 at 17:32 +0100, Simon McVittie wrote:
> > > If you're doing anything like this, please consider naming types and other new
> > > constructs using Ugly_Case (camel case with underscores at word boundaries),
> > > like Telepathy does.
> > 
> > Not sure exactly what you want me to do. It sounds more like this is
> > stuff that should go into a "IDL programming guide" as how people should
> > name their methods/properties/signals, no? I mean, binding generators
> > are free to do whatever they want.
> 
> My point is that if the definition of the IDL says that things are named
> using Ugly_Case, then transforming the IDL into the case conventions used by
> any language I can think of becomes trivial, whereas if the IDL uses a different
> case convention, mapping into other case conventions requires tricky heuristics
> which are unlikely to be right every time.
> 
> (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.)
> 
> We don't yet have *any* convention for how named structs in D-Bus are named,
> so your IDL and Telepathy's introspection extensions are free to invent a
> convention. Given that, I'm keen for the convention we invent to be one that
> avoids the problems we've seen when generating bindings into non-camelcase
> languages, particularly the C/GLib names_like_this convention, when using the
> existing convention that D-Bus methods/signals/properties are named in
> CamelCase.

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, ...)

where we define @org.freedesktop.DBus.Typelib.NamingHint in the spec as
you do for Ugly_Case? This is a bit more work for e.g. GLib cases, but I
guess that the code generator will allow you to do

 gdbus-binding-tool -f $(datadir)/dbus-1/typelib/org.example.Stuff.xml
   --naming-hint org.example.Stuff.SendDTMF=Send_DTMF

in the interim until the upstream typelib provider of the file adds the
annotation (if ever). The alternative is to hope everyone will use
Ugly_Case in the typelib and I'm not sure that's realistic since, it's,
uh, ugly...

    David




More information about the dbus mailing list