Re: [PATCH] Add GType entries to Glib typemap

Brett Kosinski said:
This patch provides the input and output rules to allow one to pass in or
return GType entries.  The patch works by using the package_from_type and
type_from_package methods to convert a package string into a type and vice
versa, so that the Perl representation of a GType is a package name.

you're using gperl_object_type_from_package as the global typemap for GTypes,
but there are two registries for GTypes in the perl bindings ---- object
types, and boxed types.  that is, stuff registered via gperl_register_object
and gperl_register_boxed use two distinct private mappings between GTypes and
packages.  with a typemap you can't guarantee which type you're always

the universal wrapper, gperl_type_from_package, looks in both stashes, but
there are many instances in which it could be very wrong to do so; when
looking up the boxed wrapper for a given type, you don't want to find object

so, i would say that a typemap isn't an appropriate approach.  you'd be better
off minimizing the number of places where a GType is needed in your API, and
handling those manually.  this is how Glib and Gtk2 do it.

having said all that, in what context do you need the GType?

muppet <scott at asofyet dot org>

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