Problems with empty Arrays and Dicts in untyped languages

Colin Walters walters at verbum.org
Thu Jul 28 04:49:50 EST 2005


On Wed, 2005-07-27 at 14:31 -0400, John (J5) Palmieri wrote:

> Would it be wrong to add a special type EmptyArray to the protocol which
> would not need a signature and would correctly map to an array of
> anytype?  I know we didn't want to add logic to the bus when dealing
> with types but this would make it much easier to support in untyped
> language bindings.

I don't think we can do this as some hack in the bus; it has to be a
protocol and binding-level change.  Remember you can do the dbus
protocol peer-to-peer too.

That said, I don't think the idea of a new DBUS_TYPE_ARRAY_EMPTY or
something is crazy inherently, but we'd need to think seriously about
the implications it has on the higher level bindings.  

Offhand, I think we could handle it in the GLib bindings because the
client has to fully specify the type when sending anyways, and on the
service end we know the full type.

In Java, as I understand it, generics are a compile-time hack; you can't
determine what class a collection contains at runtime, so there is no
way an application could tell the difference (type-wise) between an
empty array and a nonempty one.

I'm not sure about .NET though.  Would DBUS_TYPE_EMPTY_ARRAY be a
problem for the Mono bindings?

> One other point is Introspection makes this argument moot but there are
> times when using introspection may be turned off in the client (less
> round trips).

Yeah, although it should definitely be possible to make introspection
fast, caching either in the clients or in the bus or both.




More information about the dbus mailing list