[GObjectIntrospection] Cleaning up GIRepository



First of all, sorry if this is not the correct mailing list but I did
not find a more suited one (and Glib discussion happens here anyway).

I started looking for GObjectIntrospection API recently and I've seen
a lot of overlap with the original GObject/GType system.
In particular, I would like to ask why the following were
reimplemented (using the typelib and not run time type information):

1) g_object_info_get_abstract, g_object_info_get_fundamental:
equivalent informations may be queried from G_TYPE_GET_ABSTRACT,
G_TYPE_GET_FUNDAMENTAL
2) g_object_info_get_interfaces:
exists as g_type_get_interfaces + gi_repository_get_from_gtype
3) g_object_info_get_properties:
transfer could be placed as a GParamFlag and array fixed size / array
null terminated could be added as part of a new g_param_spec_array()
(I am not sure about the latter, are there properties which are GArray
/ GPtrArray / C arrays?)
then is just a matter of g_object_class_list_properties
6) g_object_info_get_unref_function & co.
I see this is to support dynamic GstMiniObject bindings, this is the
part I understand the least, as it definitely belongs in the type
system implementation, not type reflection / introspection system.
I believe bindings, either static or dynamic, should use the
facilities from GValue and GValueTypeTables.
This means that objects retrieved from the C API are placed inside a
GValue with g_value_set_instance.
Such objects are copied around as GValue, which take care of reffing
and unreffing.
The original instance pointer is retrieved for passing to C API
functions with g_value_peek_pointer.
(By the way, not only GstMiniObject and GObject are GTypeInstance,
also GParamSpec is, so this writing binding this way could facilitate
memory management)
7) Union, structs, instances all have fields and method. Also,
instances and interfaces have vfuncs. Finally, GObject / GInterface
(with a GObject prerequisite) have properties and signals.
Why each of them has its own method (pun not intended) for introspecting them?
(as a side note: Vala has methods for enums)
8) On the other hand, all GTypeInstance get a GIObjectInfo, but only
GObject has properties and signals. Would it be more appropriate to
move GObject specific code down the hierarchy?

Last comment: why none of this API uses GObject and is not even a
registered boxed?

Thanks for your time,

Giovanni Campagna


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