From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: ludo@gnu.org (Ludovic =?iso-8859-1?Q?Court=E8s?=) Newsgroups: gmane.lisp.guile.devel Subject: Re: goops proposal: proper struct classes Date: Thu, 05 May 2011 18:35:54 +0200 Message-ID: <87fwot14wl.fsf@gnu.org> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: dough.gmane.org 1304613380 12284 80.91.229.12 (5 May 2011 16:36:20 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 5 May 2011 16:36:20 +0000 (UTC) To: guile-devel@gnu.org Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Thu May 05 18:36:17 2011 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QI1XE-0002Kw-5E for guile-devel@m.gmane.org; Thu, 05 May 2011 18:36:16 +0200 Original-Received: from localhost ([::1]:33804 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QI1XD-0003Ok-Ng for guile-devel@m.gmane.org; Thu, 05 May 2011 12:36:15 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:47047) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QI1XA-0003OI-Li for guile-devel@gnu.org; Thu, 05 May 2011 12:36:13 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QI1X9-0006RE-Hr for guile-devel@gnu.org; Thu, 05 May 2011 12:36:12 -0400 Original-Received: from lo.gmane.org ([80.91.229.12]:33839) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QI1X9-0006Qv-4J for guile-devel@gnu.org; Thu, 05 May 2011 12:36:11 -0400 Original-Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1QI1X8-0002HA-51 for guile-devel@gnu.org; Thu, 05 May 2011 18:36:10 +0200 Original-Received: from 193.50.110.208 ([193.50.110.208]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 05 May 2011 18:36:10 +0200 Original-Received: from ludo by 193.50.110.208 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 05 May 2011 18:36:10 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 39 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: 193.50.110.208 X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 16 =?iso-8859-1?Q?Flor=E9al?= an 219 de la =?iso-8859-1?Q?R=E9volution?= X-PGP-Key-ID: 0xEA52ECF4 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 83C4 F8E5 10A3 3B4C 5BEA D15D 77DD 95E2 EA52 ECF4 X-OS: x86_64-unknown-linux-gnu User-Agent: Gnus/5.110017 (No Gnus v0.17) Emacs/24.0.50 (gnu/linux) Cancel-Lock: sha1:hOIvOzM+smb6HroG5r8UBek9+wA= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 80.91.229.12 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:12431 Archived-At: Hi Andy, Andy Wingo writes: > If you know GOOPS, then you know that we have classes, rooted at > . And indeed shows up a lot in documentation and in > code. But that's not how it is in CLOS: our corresponds to > their `standard-class'. They have a superclass, called `class', which > is the real root, and from which e.g. structure classes are derived. > > We need to do this. Currently, class-of on a struct/record data type > gives a useless class that can't instantiate instances, doesn't know its > slots, and does not reflect the vtable hierarchy. Here’s an illustration: --8<---------------cut here---------------start------------->8--- scheme@(guile-user)> (use-modules (oop goops) (srfi srfi-9)) scheme@(guile-user)> (define-record-type (make-foo x) foo? (x foo-x)) scheme@(guile-user)> (make-foo 2) $3 = #< x: 2> scheme@(guile-user)> (class-of $3) $4 = #< <> 148a4b0> scheme@(guile-user)> (class-slots $4) $5 = () scheme@(guile-user)> (class-of $4) $6 = #< 8e7a50> --8<---------------cut here---------------end--------------->8--- > So we need a , interposed between and , > which will be the real root of our class meta-object hierarchy. Why? Couldn’t ‘scm_i_define_class_for_vtable’ build a full-blown class, populating its CPL, its ‘slots’ slot, etc.? Thanks, Ludo’.