Re: Why GObject::constructor, not GObject::construct?



On 8 Jan 2001, Owen Taylor wrote:

> 
> As I read it:
> 
> 1) object->constructor() can only ever be called from g_object_new()

right.

> 2) The object->constructor() function must chain up as the first
>    thing it does - it can't do anything else until the object is
>    created.

right, unless you have a singleton.

> So, why don't we just have a ->construct() virtual function that
> is called after g_type_create_instance() and the construct parameters
> are set?
> 
> This would be:
> 
>  a) Just as powerful.
>  b) Simpler, because it would have a normal virtual function prototype.

nope, i posted a proposal regarding this in late august,
http://mail.gnome.org/archives/gtk-devel-list/2000-August/msg00322.html
is there to show you the motivation.

> Also, don't we need a g_object_newv() that takes a list of name/value
> pairs, since g_object_new()/g_object_new_valist() isn't language
> bindable? Or are language bindings supposed to call
> g_object_constructor() directly? (It seems a little painful to figure
> out which arguments are construct parameters, etc.)

yes, we will need a g_object_newv(), not that hard to imlplement,
however i'd like to clean up a few corner cases in the current
object_new_valist() first, then newv() is on my todo.

> 
> Regards,
>                                              Owen
> 

---
ciaoTJ





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