Open jtrees opened 4 years ago
It's a boxed type, so it should work. It might be missing CCode
attributes in the VAPI.
We have to set set_value_function to g_boxed_set_value. However, they are declared as value types, which means we need to tell Vala to use a reference. I'll figure this out.
It turns out to be more complicated than I expected because Vala view those types as value-type so it does not take a reference or indirect a pointer around GValue get/set calls.
For types that fit in a pointer (8 bytes or less), we can do a very nice trick of storing the value in the boxed pointer.
For 80 and 128 bit types, it's going to be trickier because we can't make a copy without leaking memory. I think it can be done with some macro tricks.
I'll add numeric_value_get_{type}
and numeric_value_set_{type}
definitions to mimic GValue API but for numeric types.
I still want to address the memory leak and the pointer optimization.
It seems
decimal128
can't be used for properties in classes inheriting fromGLib.Object
.Failing Code
Error Output
Working Code