NULL Variants?

Colin Walters walters at verbum.org
Wed Aug 31 08:34:17 PDT 2005


On Mon, 2005-08-29 at 18:50 +0200, Jakub Piotr Cłapa wrote:

> So maybe a NILL type should be brought back?

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.

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

Another way to put this is to look at the success of XML-RPC, which is a
pretty dumb protocol really.  But the point is that it's easy to use for
most cases and generally just gets the job done.

> > I would be bummed to have to implement a nasty hack such as Jakub's (no
> > offense) when using a modern system like dbus.
> 
> I'm not offended -- I perfectly understand that this is a nasty hack but 
> as with most nasty hacks I had little choice. ;]

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.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.freedesktop.org/archives/dbus/attachments/20050831/ca5aef4d/attachment.pgp


More information about the dbus mailing list