[cairo] GObject

mental at rydia.net mental at rydia.net
Wed Jan 11 10:22:39 PST 2006

Quoting Bill Spitzak <spitzak at d2.com>:

> What exactly does GObject provide

 1. Automatic garbage collection (refcounted)

 2. Run-time polymorphism

 3. Named callbacks ("signals")

 4. Reflection support

> and why is it so hard to remove from Pango?

Cairo implements 1) and 2) internally, as that's all it needs and it
only has a few "classes", so it can get away with not generalizing
that part of the code.

Pango, however, (I think) uses all four facilities, and has lots of
distinct "classes".  You could replace the usage of GObject with
tailored code, but assuming you wanted to keep it well-factored
you'd end up with an internal library that looked suspiciously like
GObject, only incompatible.  Perhaps the new code wouldn't depend on
glib, but the rest of Pango still would.

It's a bit like asking "why is it so hard to port this non-trivial
Java program to C?"  You either implement a relevent subset of Java
features in C as a library, or you do a more comprehensive rewrite.


More information about the cairo mailing list