On Tue Jun 12 22:50:02 2007 +0200 "Andy Wingo" wrote: >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 ..)
Mh, no[1]. But thanks anyway, it has been a good occasion to inspect some of GOOPS. Meanwhile I have changed my design, so I need that no more. Ciao. [1] <http://community.schemewiki.org/?goops-allocate-instance> -- Marco Maggi _______________________________________________ Guile-user mailing list Guile-user@gnu.org http://lists.gnu.org/mailman/listinfo/guile-user