Re: Scripting in Gnome

On 06/02/04 02:46, Bob Smith wrote:

Exactly. This was what I was talking about when I suggested making
GObject's self describing. a GObject could then be introspected by
CORBA, DBus, Python, Whatever to allow the scripting functionality
easily. I think GObject's properties are self describing currently but
methods are not. Anyone know what else would need to be described to
make this possible?
The ORBit2 IInterface IDL would be worth looking at for this kind of thing. You basically want:

   * get the type of an object (we already have this with
   * A way to find all base classes of a particular class (also already
   * A way to get a list of the methods of a class.
   * For each method on the class:
         o The return type
         o List of argument names (you might consider this optional)
         o List of argument types
         o Whether each argument is in, out or inout.
   * Require that all function arguments and return values can be
     represented by the type system (this requires a fair bit of
     work).  This might involve extending the type system.
   * Some way to invoke a method on an instance programatically.

The last one is probably most difficult. The two ways to solve it are to generate marshalling code (similar to what we do for signals), or use something like libffi to construct the function calls (probably making use of the interface information to help construct the call).

For GTK, we haven't really had to worry about this because C can already call C functions quite easily :) For CORBA, they needed to deal with this from the start, since they needed to be able to convert invocations from the network into function calls.

Note that most of the language bindings for dynamic languages actually implement most of this already. Unfortunately, the format they expose all the class information in is "Python classes" or "Perl classes", and method calls are done using the "Python method call interface" or "Perl method call interface" :) This isn't very helpful if you are trying to use the information from a language other than the one the binding is for ...


Email: james daa com au

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