From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Panicz Maciej Godek Newsgroups: gmane.lisp.guile.user Subject: Re: A mess with GOOPS Date: Mon, 5 Sep 2011 23:35:28 +0200 Message-ID: References: <87y5y5230u.fsf@pobox.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: dough.gmane.org 1315258546 12278 80.91.229.12 (5 Sep 2011 21:35:46 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 5 Sep 2011 21:35:46 +0000 (UTC) Cc: guile-user@gnu.org To: Andy Wingo Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Mon Sep 05 23:35:41 2011 Return-path: Envelope-to: guile-user@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 1R0gpQ-0005Me-UB for guile-user@m.gmane.org; Mon, 05 Sep 2011 23:35:41 +0200 Original-Received: from localhost ([::1]:52059 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R0gpK-0000IR-KA for guile-user@m.gmane.org; Mon, 05 Sep 2011 17:35:34 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:50914) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R0gpH-0000IM-67 for guile-user@gnu.org; Mon, 05 Sep 2011 17:35:32 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R0gpF-0002xy-Uo for guile-user@gnu.org; Mon, 05 Sep 2011 17:35:31 -0400 Original-Received: from mail-vx0-f169.google.com ([209.85.220.169]:37257) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R0gpF-0002xu-SN for guile-user@gnu.org; Mon, 05 Sep 2011 17:35:29 -0400 Original-Received: by vxj3 with SMTP id 3so4949743vxj.0 for ; Mon, 05 Sep 2011 14:35:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=63kXujS5Mprim7jKNg9GXegOWjqAOio7m2J/Nq2ysuE=; b=kRyKenyErhD6dwxfDSWsMr3xMeGkQ8You1quraldnJa1i1fjuwLKi3dL62EtLQzjU3 likIEN+XonHB1+atYCK3sSvSjD6Sjuqn9fZknNAnbC7HJyis5RPQz+jbzmBhoC8c8bYd Yh+DiqCkHUP3Z0AWpbIlYd3/z17iItRzUK+YM= Original-Received: by 10.52.22.237 with SMTP id h13mr613129vdf.228.1315258528252; Mon, 05 Sep 2011 14:35:28 -0700 (PDT) Original-Received: by 10.220.187.68 with HTTP; Mon, 5 Sep 2011 14:35:28 -0700 (PDT) In-Reply-To: <87y5y5230u.fsf@pobox.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 209.85.220.169 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:8772 Archived-At: I've been trying to add the superclass. Adding it to and turned out to be extremely simple, but the problem emerged when I was trying to generalize the class. The thing is that is implemented as a smob, and that there is no easy way to add a superclass to a class created from smob. I can think of a number of ways of making a workaround, but all of them are nasty. Each of them will require the modification of goops.c: create_smob_classes. The first way would be to check whether !strcmp (SCM_SMOBNAME (i), "array") and to behave appropriately when it happens. But that would be just ugly. The other two ways that come to my mind would be: 1. to modify the type `scm_smob_descriptor', adding SCM supers; /* list of superclasses */ or, equivalently 2. to add a new global array, SCM_API SCM smob_supers[MAX_SMOB_COUNT], such that their default would either be SCM_EOL, or scm_list1(scm_class_top). The other idea would be to mess with scm_sys_inherit_magic_x and add a superclass after the creation of "", but that doesn't sound too sound (at least for as long as this action is undocumented) So to me it seems that adding the (or however should it be called) that would be the ancestor of "array" requires some changes in the guile API. I wouldn't do it without the overall approval. Best regards M. 2011/9/3, Andy Wingo : > Hi Panicz, > > On Fri 02 Sep 2011 21:53, Panicz Maciej Godek > writes: > >> In other words, classes , and have nothing in >> common, which requires me to triple the number of methods that could >> accept any of these types. > > We should fix this. We can probably do it in 2.0. Interested in > sending a patch? > > Currently this stuff is in C, unfortunately. Perhaps it should move to > Scheme at some point, but if you just wanted to add an or > superclass, see goops.c. Look for the stuff > and follow the patterns. > > Andy > -- > http://wingolog.org/ >