unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Andy Wingo <wingo@pobox.com>
To: Doug Evans <dje@sebabeach.org>
Cc: guile-user@gnu.org
Subject: Re: smob gc protection, and inheritance
Date: Sat, 07 Sep 2013 10:22:49 +0200	[thread overview]
Message-ID: <878uz9yrae.fsf@pobox.com> (raw)
In-Reply-To: <m3hae1k8nc.fsf@seba.sebabeach.org> (Doug Evans's message of "Tue, 03 Sep 2013 12:27:51 -0700")

On Tue 03 Sep 2013 21:27, Doug Evans <dje@sebabeach.org> 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/



  parent reply	other threads:[~2013-09-07  8:22 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-03 19:27 smob gc protection, and inheritance Doug Evans
2013-09-04 21:13 ` Ludovic Courtès
2013-09-05 19:43   ` Andrew Gaylard
2013-09-06 12:19     ` Ludovic Courtès
2013-09-07  8:22 ` Andy Wingo [this message]
2013-09-07 14:17   ` Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=878uz9yrae.fsf@pobox.com \
    --to=wingo@pobox.com \
    --cc=dje@sebabeach.org \
    --cc=guile-user@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).