Re: changing inheritance == API breakage



On Sat, 7 Jan 2006, muppet wrote:

[/me takes a few more swats at the horse, in case it's still breathing...]

Tim mentioned something the other day about glib's type system being completely dynamic, and that code must be prepared for the insertion of new types. This didn't sit well with me, but i couldn't express it, and got sidetracked.

It occurred to me on the plane this evening that the hierarchy actually cannot be dynamic, because it is encoded in structure definitions. By using same-size structures and casting you can avoid most problems, but changing the hierarchy of a GObject derivative does, indeed, result in API breakage.

Consider this code:

     if (widget->object.parent_instance.ref_count > 1) {
         ...
     }

accessing a widget's parent type other than through explicit casts
is not supported for many years. we don't even have a consistently used
naming convention for the embedded parent class type in a structure.

--
I think it worked on the Wiley Coyote model of project management - if
at any point you looked down and realised what you were doing was
impossible then you'd instantly fail.
 -- Simon Wistow

---
ciaoTJ



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