Re: Function completion for GVariant maybe types?



On Tue, 2011-10-11 at 19:37 +0200, Markus Elfring wrote:
> I stumbled on the detail that the functions "g_variant_is_of_type" and
> "g_variant_is_container" are provided directly while some predicates can only be
> checked by the others.

g_variant_is_of_type (gv, G_VARIANT_TYPE_MAYBE) will do what you expect.

> > The name is a bit misleading because in our APIs _set_*() tends to mean
> > that you're modifying an object in some way (which is not what happens here).
> 
> Would you prefer a name like "g_variant_create_maybe_from_source" over my
> suggestion "g_variant_set_to_nothing"?   ;-)

I think I'd just prefer not to have such an API :)

> Why should it be easier to implement the special copy operation in my code?
> 
> Do more GLib software developers need the suggested functionality?

I'm not aware of anyone who does.

GVariant is typically used in situations where there are strong
expectations on the types of values in use and not much need for
converting between different types.

In fact, if we were to add any sort of 'additional flexibility' here, it
would be in terms of introducing functions that are more flexible with
respect to the different integer types... That issue has been raised a
couple of times, but even in that case there doesn't seem to be a
burning need.

Cheers



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]