Re: [Vala] Chaining up constructors.
- From: Jürg Billeter <j bitron ch>
- To: Yu Feng <rainwoodman gmail com>
- Cc: vala-list <vala-list gnome org>
- Subject: Re: [Vala] Chaining up constructors.
- Date: Sun, 23 Nov 2008 20:24:20 +0100
On Sun, 2008-11-23 at 14:01 -0500, Yu Feng wrote:
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:
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?
Any response to that?
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.
'private set' (and in the future also 'internal set') should not mark
the property as writable in the paramspec, as the paramspec should
represent the public interface, not the internal/private.
Jürg
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]