Re: Sinkability considered harmful

Tristan Van Berkom said:
> muppet,
>      GtkObject is a special case, it means that in your
> binding you have to distinguish it from a GObject and treat
> it differently, if there were no floating flag; you wouln't
> need to do this.

This is indeed the situation -- the binding treats GtkObjects differently from
GObjects.  What i was trying to say was that the floating reference allowed us
to treat all GtkObject returns identically, while we must pay very close
attention to non-GtkObject returns to get ownership correct.

Having dealt with a lot of legacy C code that uses some incredibly wonky
lifetime management conventions (e.g. "all functions consume their arguments",
or "some objects start their lifetime with a reference count of 0", a single
object with three reference counts, or "complete spaghetti madness"), i am
extremely uncomfortable with having pointers that can be made to point to bad
memory as an unseen side effect.  Although it may make usage the API cleaner
and more succinct, it leads to subtle, easy-to-cause bugs.

That is, although the floating semantic is nice and convenient, i find it
problematic for maintenance and would not use it on my own object trees.

muppet <scott at asofyet dot org>

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