Re: Should we wrap accessors for properties?



Torsten Schoenfeld <kaffeetisch gmx de> writes:

I'm going through the new API in gtk+ 2.14.  As usual, there are quite a few
accessors added for new properties.  For example,
gtk_calendar_get_detail_height_rows and
gtk_calendar_set_detail_height_rows for the "detail-height-rows" property of
GtkCalendar.  I wonder if we should continue to wrap those.

They're pretty tedious.  They make more sense in C.  Starting from
scratch you'd be very tempted to leave them out ...

The new properties are automatically available via the generic property
mechanism ($object->set (foo => ...)

One difference is I think most of the set_foo() don't emit the notify
signal if the value is unchanged, whereas the generic set() emits
always.  A misfeature in that generic no doubt, but one that's probably
unfixable.

(Sloppy code which always does another set() in response to a notify or
toggled or whatnot has good scope for going into an infinite loop unless
there's someone in a cycle checking if the value is unchanged ...)


muppet <scott asofyet org> writes:

In retrospect, it would've been cleaner to use a separate "properties"
hash.

I guess a tied hash which was just property get/set could work.
(Somehow ties always seem more attractive in the idea than the actual
use.  I suppose the power comes when you plug it into another library
etc that's demanding a hash/array/whatever.)



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