Problems with empty Arrays and Dicts in untyped languages

John (J5) Palmieri johnp at redhat.com
Thu Jul 28 05:15:09 EST 2005


On Wed, 2005-07-27 at 15:07 -0400, Joe Shaw wrote:
> Hi,
> 
> On Wed, 2005-07-27 at 14:49 -0400, Colin Walters wrote:
> > 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.  
> >
> > I'm not sure about .NET though.  Would DBUS_TYPE_EMPTY_ARRAY be a
> > problem for the Mono bindings?
> 
> If I understand correctly, in the event of getting DBUS_TYPE_EMPTY_ARRAY
> we could reflect to see what array type the caller was expecting and
> then return an empty array of that type.  But that's pretty gross.

No the point is the other way around.  When sending an empty array some
languages have no way of knowing what array type to send without
Introspection.  DBUS_TYPE_EMPTY_ARRAY would free these languages from
figuring it out by allowing an empty array to map to an array of any
type.

I'm not quite sure why this would be a problem in .Net or Java.  If an
array of anytype has no elements just marshal it to
DBUS_TYPE_EMPTY_ARRAY.

-- 
John (J5) Palmieri <johnp at redhat.com>



More information about the dbus mailing list