From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Andy Wingo Newsgroups: gmane.lisp.guile.user Subject: Re: smob gc protection, and inheritance Date: Sat, 07 Sep 2013 10:22:49 +0200 Message-ID: <878uz9yrae.fsf@pobox.com> References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1378542189 5326 80.91.229.3 (7 Sep 2013 08:23:09 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 7 Sep 2013 08:23:09 +0000 (UTC) Cc: guile-user@gnu.org To: Doug Evans Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Sat Sep 07 10:23:13 2013 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1VIDnV-0008T8-3t for guile-user@m.gmane.org; Sat, 07 Sep 2013 10:23:13 +0200 Original-Received: from localhost ([::1]:41129 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VIDnU-00042w-Ju for guile-user@m.gmane.org; Sat, 07 Sep 2013 04:23:12 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:48705) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VIDnH-00042I-OS for guile-user@gnu.org; Sat, 07 Sep 2013 04:23:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VIDnD-0002pP-9Z for guile-user@gnu.org; Sat, 07 Sep 2013 04:22:59 -0400 Original-Received: from a-pb-sasl-quonix.pobox.com ([208.72.237.25]:55059 helo=sasl.smtp.pobox.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VIDnD-0002ox-5H for guile-user@gnu.org; Sat, 07 Sep 2013 04:22:55 -0400 Original-Received: from sasl.smtp.pobox.com (unknown [127.0.0.1]) by a-pb-sasl-quonix.pobox.com (Postfix) with ESMTP id 314E9EDD1; Sat, 7 Sep 2013 04:22:53 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; s=sasl; bh=vqnTXidHaqD1H4FrY7Co3BhhfU8=; b=JUvjSv vFKZbcOvFg4UKu0RLUO8H1QFUUdwPaqWqf56jVdXmrInxrrs8vFh5TB0gHAwGB+U I2ZCkeRsXWq88EREzkcFt6KA4/kepF5v168ZMUIYdJLpljjIC6Yd3hzBgQQGRTwU gC6x0VWjMyrvmFbOWoKNozaHmsX+LMhQadFqg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; q=dns; s=sasl; b=EnQTCt5k/QwF+AQ+tsWyX1B+QVglIwkZ iitDsaUJqtiRmR3HRtKvN4ThajCexe1dgUQJQ84x3PPX5KiOTIeHRlQNg3Q0SQqv /HtynRqVOrSvAlS31dO1kXfT0Rc7q505RSr4Rd8wH4qJVuRBjk3smXeWb2r8oOvV WB6Q6ZcYYY8= Original-Received: from a-pb-sasl-quonix.pobox.com (unknown [127.0.0.1]) by a-pb-sasl-quonix.pobox.com (Postfix) with ESMTP id 1EF88EDD0; Sat, 7 Sep 2013 04:22:53 -0400 (EDT) Original-Received: from badger (unknown [88.160.190.192]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by a-pb-sasl-quonix.pobox.com (Postfix) with ESMTPSA id 61BA2EDCF; Sat, 7 Sep 2013 04:22:52 -0400 (EDT) In-Reply-To: (Doug Evans's message of "Tue, 03 Sep 2013 12:27:51 -0700") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) X-Pobox-Relay-ID: B0846992-1796-11E3-AF3E-CE710E5B5709-02397024!a-pb-sasl-quonix.pobox.com X-detected-operating-system: by eggs.gnu.org: Solaris 10 X-Received-From: 208.72.237.25 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Original-Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.user:10756 Archived-At: On Tue 03 Sep 2013 21:27, Doug Evans 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/