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: base class parameterisation? Date: Tue, 12 Jun 2007 22:50:02 +0200 Message-ID: <1181681403.4168.105.camel@localhost.localdomain> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1181685561 22735 80.91.229.12 (12 Jun 2007 21:59:21 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 12 Jun 2007 21:59:21 +0000 (UTC) To: guile-user@gnu.org Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Tue Jun 12 23:59:20 2007 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1HyEOU-0000G2-KV for guile-user@m.gmane.org; Tue, 12 Jun 2007 23:59:18 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HyEOU-00017i-D2 for guile-user@m.gmane.org; Tue, 12 Jun 2007 17:59:18 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1HyEOM-00013P-B4 for guile-user@gnu.org; Tue, 12 Jun 2007 17:59:10 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1HyEOL-00012v-9P for guile-user@gnu.org; Tue, 12 Jun 2007 17:59:09 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HyEOK-00012c-Tw for guile-user@gnu.org; Tue, 12 Jun 2007 17:59:08 -0400 Original-Received: from ambient.dashsystems.com ([216.27.85.7] helo=kettle.ambient-hosting.net) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1HyEOK-0006SA-6B for guile-user@gnu.org; Tue, 12 Jun 2007 17:59:08 -0400 Original-Received: from localhost.localdomain (ambient-hosting.net [10.1.6.1]) by kettle.ambient-hosting.net (Postfix) with ESMTP id CC4C68809E for ; Tue, 12 Jun 2007 17:59:06 -0400 (EDT) Original-Received: by localhost.localdomain (Postfix, from userid 1000) id 90F181187F0; Tue, 12 Jun 2007 22:50:03 +0200 (CEST) In-Reply-To: X-Mailer: Evolution 2.10.1 X-detected-kernel: Linux 2.4-2.6 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.user:5990 Archived-At: Hi Marco, On Sat, 2007-06-09 at 08:18 +0200, Marco Maggi wrote: > ---A--- > | | > v v > A1 A2 > > B > > I wonder if there is a way to parameterise the construction > of 'B' to let it have 'A1' or 'A2' as base class. I do not > want to use delegation. I suspect you will have to make a metaclass and specialize on allocate-instance. Something like (my GOOPS is rusty): (define-class A-metaclass ()) (define-method (allocate-instance (class A-metaclass) initargs) (if (random-predicate) (allocate-instance A1) (allocate-instance A2))) (define-class B () #:metaclass A-metaclass ..) Good luck, Andy. -- http://wingolog.org/ _______________________________________________ Guile-user mailing list Guile-user@gnu.org http://lists.gnu.org/mailman/listinfo/guile-user