Re: Introspection




On Jan 10, 2005, at 11:12 PM, Maciej Katafiasz wrote:

... In any case, there should
  probably be a way to find out the struct offsets, so that
  language bindings don't have to implement the struct layout
  calculations themselves.

Bindings are supposed to use libffi anyway.

i didn't know i was *supposed* to have used libffi.  ;-)

It's quite probable that they will have to do things like generating thunks/marshallers for vmethods on the fly anyway, so that's an already existing dependency, and I guess libffi is supposed to do things like creating structs layout on demand, right?

libffi isn't a dependency for either gtk2-perl or (afaik) pygtk.

i would've pounced on libffi for things like binding variadic C functions, but the docs at http://sources.redhat.com/cgi-bin/cvsweb.cgi/libffi/README? rev=1.8&content-type=text/x-cvsweb-markup&cvsroot=libffi, as well as gcc-3.4.1/libffi/README say that libffi doesn't support them, so...



* Should documentation be included in the metadata ?

YES! Everyone loves docstrings.

... so long as you have gobs of ram for the bloat they will add to the binary blob.


* Should type information for parametrized container types
  be provided on the gobject level, or should we do a simple
  ad-hoc description for such types ?

How would such ad-hoc description work? Hardcoded knowledge about GList,
GHashTable, etc. into each binding?

I would think something like "GList of GObject" or "GHashTable string to integer" would be quite sufficient. Generically, "GList of <typename>", "GSList of <typename>", "GHashTable <key typename> to <value typename>".

The bindings have to have *some* knowledge of what they're wrapping. For instance, Gtk2-Perl hides the existence of GList & GHashTable altogether, instead translating these into perl's native arrays and hashes. This is actually harder than just giving back opaque handles to the caller, but makes the API easier to use in perl. The bindings also have to have some knowledge of a GObject and a GBoxed. It's having to know about *every* struct and *every* instance of a GList that introspection would help avoid.


--
That's it! It's one thing for a ghost to scare my children, but it's another to play my theremin!
  - Homer Simpson




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