[SPAM] Re: property API vs fields
- From: "Steph Fox" <steph zend com>
- To: "Owen Taylor" <otaylor redhat com>, "Murray Cumming" <murrayc murrayc com>
- Cc: PHP-GTK doc <php-gtk-doc lists php net>, Gtk+ Developers <gtk-devel-list gnome org>, Tim Janik <timj imendio com>
- Subject: [SPAM] Re: property API vs fields
- Date: Thu, 17 Aug 2006 17:43:16 +0200
On Thu, 2006-08-17 at 11:25 +0200, Murray Cumming wrote:
> On Sun, 6 Aug 2006, Steph Fox wrote:
>
>> Hi GTK people,
>>
>> The PHP-GTK doc team have hit a point of confusion over the property
>> API
>> in
>> GTK 2, mostly because publicly accessible fields hanging over from GTK
>> 1
>> are
>> still publicly accessible. We don't know whether to promote the use of
>> *_get_|set_property() or not, and to some extent that depends on
>> whether
>> it
>> will eventually be enforced by the GTK+ team.
I mean to reply to this earlier.
GTK+ is very unlikely to change those struct fields, even if they could
do
so while keeping the struct size the same. It would just be too risky
because someone's hack probably depends on the non-public API. The
situation is avoided with new code by using the GObject "private" data.
Do use the property API wherever it exists. It does more than just
setting/getting a struct field.
However, some of those struct fields really are public. I forget exactly
what the rule is, and I can't find the email where this was stated. It's
either
- They are public unless marked private.
or
- They are private unless marked public.
Whatever the rule is, it's probably not followed perfectly. A list of
structs where this isn't clear would probably help people to improve the
documentation.
The rule is:
Object instance structures: private unless marked public. (public
fields are read-only)
Normal structures: public unless marked private.
However, there are supposed to be *no* places in the GTK+ API where
you have to read an object instance structure field, even if it
is marked public; the intention there is 100% coverage with getters.
If I find any when we switch to a more recent version of GTK+ I'll check CVS
and bug it.
Thanks all of you for your responses!
- Steph
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]