Re: Function completion for GVariant maybe types?

   - if you pass in NULL, return a Nothing of (arbitrary) type "ms"

Do you like a different value better than an empty "maybe" string as a reasonable default?

     - if the maybe contains no value, crash

I would appreciate if I can complete the error detection and corresponding exception handling for my suggestion with a bit more information.

     - if the maybe contains a value, return the NULL of the same type

Would you like to recommend any better way to drop the value that was contained in the previous object?

Even correcting the bugs, I can't imagine any situation in which this
function would be useful.

I hope that the need can be clarified.

Can you please explain, at a higher level, what you are trying to accomplish?

Yes, of course.

I started my feature request with such an approach, didn't I?

I am still looking for an implementation for the following question:
How should a GVariant variable be reset to the special marker "nothing" after
it was used with other concrete values for a while?

Simon informed me that GVariants can not be directly reset from the point of view of the Glib programming interface. The API design pattern "immutable object" has got consequences.

The only function that creates/generates "nullable objects" is "g_variant_new_maybe" so far, isn't it?

I understood its functionality in the way that if a maybe object is passed to it, a new instance will be created with a nested maybe type. I do not want additional nesting of data types here. I want just an empty/null value which has got the data type information preserved from the previous object.


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