On Sun, 2008-11-23 at 11:32 +0100, Jürg Billeter wrote:
> On Sun, 2008-11-23 at 05:07 -0500, Yu Feng wrote:
> > On Sun, 2008-11-23 at 11:00 +0100, Jürg Billeter wrote:
> > > On Sun, 2008-11-23 at 04:53 -0500, Yu Feng wrote:
> > > > On Sun, 2008-11-23 at 10:03 +0100, Jürg Billeter wrote:
> > > > > On Sun, 2008-11-23 at 00:13 -0500, Yu Feng wrote:
> > > > > > Both vala 0.5.1 and trunk fails to smoothly switching the parent
> > > > > > classes. if I have extra stuff in the creation methods.
> > > > > 
> > > > > Do you have an example or bugzilla link?
> > > > 
> > > > I was experiencing the problem with that piece of DOM project. this is
> > > > an abridged version:
> > > > 
> > > > class AAA: Object {
> > > > 
> > > > 
> > > >     public AAA() {
> > > >         int i = 10;
> > > >     }
> > > > }
> > > > class BBB: AAA {
> > > > 
> > > >     public int j {get; construct;}
> > > >     public BBB() {
> > > >         base();
> > > >         j = 100;
> > > >     }
> > > > }
> > > 
> > > You should use "private set" here instead of "construct" with the new
> > > construction scheme. This shouldn't cause any issues.
> > 
> > The situation is:
> > (1) I need j to be a construct property because the object eventually is
> > going to be created with g_object_new.
> 
> What's the reason that you use g_object_new to create the object?
> 
> Would it be possible to create the object with default values first and
> set the properties later?
Practically that works, but ...
After these properties(nodeName of a DOM.Node) are initialized by
g_object_new, they should never be modified. In the specification they
are stated as 'read-only'.

If I modify them later, I have to make them writable. Besides gobject
doesn't have a built-in 'private set' property concept. Keep in mind
some language bindings can use g_object_set/set property to get and set
properties, therefore the paramspec for the property has to precisely
describe the property's behavior.



> Jürg
> 

_______________________________________________
Vala-list mailing list
Vala-list@gnome.org
http://mail.gnome.org/mailman/listinfo/vala-list

Reply via email to