From: Andy Wingo <wingo@pobox.com>
To: guile-user@gnu.org
Subject: Re: base class parameterisation?
Date: Tue, 12 Jun 2007 22:50:02 +0200 [thread overview]
Message-ID: <1181681403.4168.105.camel@localhost.localdomain> (raw)
In-Reply-To: <JJCUUL$3D0277CD7F6CDAEA46211A5A993CA88A@poste.it>
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 (<class>))
(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
next prev parent reply other threads:[~2007-06-12 20:50 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-06-09 6:18 base class parameterisation? Marco Maggi
2007-06-12 20:50 ` Andy Wingo [this message]
-- strict thread matches above, loose matches on Subject: below --
2007-06-25 13:57 Marco Maggi
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=1181681403.4168.105.camel@localhost.localdomain \
--to=wingo@pobox.com \
--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).