libpeas, multiple languages, toggle references



Was talking about this with Matthias on IRC, and he suggested that it
would be good to make the point to a larger audience.

 * libpeas seems to have support for loading plugins written in both
   Python and Javascript in the same process.

 * Both seed and pygobject use GObject toggle references.

 * GObject toggle references only work with GObject + *one* language
   binding. If two toggle references are established on the same
   GObject from different bindings that object will leak forever.

 * GObject toggle references are really the state of the art for
   connecting reference counting to garbage collection. That means:

   - I'm not aware of any way of fixing the 'one toggle reference
     or leak' limitation.
   - All other ways of doing it I know of are worse.

To put it simply, you can't mix multiple garbage collected runtimes
in the same process, have them share pointers to the same objects,
and have that work OK. 

[Given backpointers from C object to language object, and backpointers
are a must for any advanced language binding.]

So, do we really want to promote this as the way we do plugins in GNOME?
Language neutrality for plugins seems nice, but is a bit of a trap.

- Owen





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