Re: Using By-Value Compound Getters (Re: gtk_widget_get_allocation)



Hi,

On Tue, Apr 21, 2009 at 2:00 PM, Tim Janik <timj lanedo com> wrote:
> Keeping current uses just because we're used to them is going to
> prevent change for the better. And introducing a new API style will
> create "inconsistencies" only temporarily, fixing all getters over to
> the new style and cleaning old cruft gets rid of the "inconsistency"
> argument as well.
>

This is only true if we're really going to go change all the current
examples (I have no idea how many there are, but I would guess a lot).

For example, the entire GtkTextBuffer API with GtkTextIter I guess
would change. Is b) really enough better to be worth that? The point
isn't that we _can't_ fix the inconsistencies but that fixing them
might be a huge amount of pain, compared to the
not-all-that-clear-anyway advantages of b) over a).

Also: _how_ would we fix the inconsistency? The function names are all
already taken. So we'd end up with
gtk_text_buffer_get_start_iter_retval() or something, I don't know. Or
else major ABI breakage.

At least, someone should quickly glance through and see how much pain
this is going to be and whether it's even feasible.

Side note, gdk_window_get_user_data() is a flawed example; that
function is wrong by the current guidelines, which would require a
pointer to be a return value.
The current guideline is that structs are done as out params always,
pointers and primitive types as return value if there's just one,
pointers and primitive types as out param if the function returns
multiple values. ("int get_x()" but "get_coords(int *x, int *y)")

Proposed way to move forward:
 * if there's a sane path to fix all the current existing functions,
there must be a sane path to fix gtk_widget_get_allocation().
 * I'd suggest putting in gtk_widget_get_allocation() using current guidelines
 * if we change the guidelines, modify and migrate the entire library
at one time, including at that time get_allocation()

Not sure we need to block merge of get_allocation() on this major
other patch to change the entire guideline. Changing the entire
guideline will be a giant change and giant patch anyhow, so changing
get_allocation() again will be a drop in the bucket.

Havoc


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