[gtkada] Ada interfaces vs. GLib interfaces

Emmanuel Briot briot at adacore.com
Mon Jul 1 20:45:16 CEST 2013


> Why should it be different with interfaces?
> 
>   type Gtk_Tree_Model_Record is interface;
>   type Gtk_Tree_Model is access all Gtk_Tree_Model_Record'Class;
>   function Get_Iter_First  (Model : not null access Gtk_Tree_Model_Record) 
>      return Gtk_Tree_Iter is abstract;
>   ...
> 
>   type Gtk_List_Store_Record is
>      new GObject_Record
>      and Gtk_Tree_Model_Record with private;
>   overriding
>   function Get_Iter_First  (Model : not null access Gtk_List_Store_Record) 
>      return Gtk_Tree_Iter;

That of course mean that you need to duplicate all the inherited subprograms,
since you can't have bodies for primitives of interfaces. Given the number of
interfaces that now exist in gtk+, you are increasing the size of the library very
significantly.

Again, feel free to experiment with the code generator in python. We are unlikely
to do these changes, since we have no customer demand for them, and they
have significant impacts on the binding.

> Note that Gtk_Tree_Model_Record will not be a descendant of GInterface.

which might or not be a problem. There are people using gtk+ and glib at very
low-levels...

Emmanuel


More information about the gtkada mailing list