On Tue 03 Sep 2013 21:27, Doug Evans <[email protected]> writes:

> 2) Is it possible to inherit, e.g., with goops, a smob?
> IOW, can I extend a smob through inheritance?
> Or must I store the smob in a class, and provide accessors?
> [kinda like the "is a" vs "has a" relationship]

You can't really inherit from a SMOB in GOOPS.  SMOB types have
corresponding GOOPS classes, but in a practical sense they can only be
used as specializers on methods; they aren't useful as constructors or
superclasses.  This is because GOOPS objects and SMOB objects have
different representations.

It's possible to do SMOB-like things in GOOPS but it is tricky and not
well documented.  Guile-GNOME does this; see
http://git.savannah.gnu.org/cgit/guile-gnome.git/tree/glib/gnome/gobject/gtype.scm
for more.

Lately what I have been doing is just using the FFI, and setting
finalizers on pointers as needed.

Regards,

Andy
-- 
http://wingolog.org/

Reply via email to