Re: Interface implementation in language bindings

On Fri, 2005-03-04 at 14:43 +0000, Mark McLoughlin wrote:

> 	Another thing that might be worth considering when it comes to
> derivation is how to expose the notion of class properties - e.g. a
> GtkAction sub-class may need to set menu_item_type/toolbar_item_type
> when deriving:
>   class MyAction (GtkAction):
>       menu_item_type = MyMenuItem
>       toolbar_item_type = MyToolItem
>       def __init__ (self):
>           ....

In general, I'd consider GObjects with class member variables to be
buggy with respect to language bindings. The concept simply won't
map into most languages.

For GtkAction, I think what we said is that those member variables
were OK since they were only used in the default implementation of
create_menu_item/create_tool_item, and subclasses can simply 
override those functions instead.

> 	It seems like you'd need for classes to register their class
> properties, implement set_class_property(), allow derived classes to set
> properties after class initialization and prior to the first
> instantiation ...

If we wanted to support this from the introspection data, I think all
we'd need to do is have a way to represent fields in the class
structure. The rest is up to the language binding. But the whole 
concept of class member variables maps so poorly across different
language bindings that I think we should avoid putting it into the
introspection data.


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