NULL Variants?

Nate Nielsen nielsen-list at memberwebs.com
Wed Aug 31 12:16:14 PDT 2005


Colin Walters wrote:
> One data point here is that some languages like Python have an obvious
> mapping for NIL values (i.e. "None" in Python's case), not every
> important language target does.  For example, I don't know how we would
> represent even just "NIL variant" in the GLib bindings.  GValue doesn't
> seem to let you set a GValue to G_TYPE_NONE.  We could create our own
> GType for it I suppose...
> 
> For the C# bindings, it looks like the next version of C# will support
> this concept directly:
> 
> http://msdn.microsoft.com/vcsharp/2005/overview/language/nullabletypes/
> 
> But even then, it isn't released yet.

Interesting. Traditionally having variants without a 'not-set' state
doesn't really make sense. But given the implementation problems, I see
why the choice was made.

> I think the larger point here is that every concept we push down to
> D-BUS has a cost associated with it, not only just the implementation
> complexity but also the impact on all of the bindings and code written
> using them.  D-BUS is a very pragmatic project; it lets you solve the
> common problems of finding another program and speaking in terms of
> method calls of strings and integers and such to it. 

Agreed. But it seems it has grown from it's original intent, and now
everyone is trying to implement complete 'objects' in it. Perhaps it's
wrong for people to force DBUS into something it's not. On the other
hand DBUS has obviously been 'stretched' in certain areas to fill
various needs. Eventually a little rounding out might be in order, to
implement those 'stretched' portions completely and properly.

> Contrast with
> CORBA on the other hand, which tries to be all things to all people, and
> this makes it very difficult to implement and understand.  

Agreed.

> As an alternative to picking unused values, you could send these values
> over as a structure with type signature "(bv)", where the boolean
> represents whether the value is set or not.   I think this basically
> solves the problem.

Good idea. Didn't think of that. I guess past experience sometimes locks
me into a certain way of thinking. Thanks.

Cheers,
Nate



More information about the dbus mailing list