[plt-scheme] Multiple inheritance problem with mixins

From: Daniel Pinto de Mello e Silva (daniel.silva at gmail.com)
Date: Wed Feb 2 22:44:21 EST 2005

Hi,
I have some shared functionality between two mixins that shouldn't
know about each other.  I wanted to implement the shared functionality
as another mixin, but I get an error:
class*: superclass already contains method: m for class: stdin::57

Is there a good way to abstract out shared functionality from two
mixins?  This is the distilled example:

(require (lib "class.ss"))

(define (shared-mixin %)
  (class %
     (super-new)
     (define/public (set-expansion x) (void))
     (define/public (get-expansion) (void))))

(define (tab-completion %)
  (class (shared-mixin %)
     (super-new)
     (inherit set-expansion get-expansion)))

(define (online-error-reporting %)
  (class (shared-mixin %)
     (super-new)
     (inherit set-expansion get-expansion)))

(define the-class% (online-error-reporting (tab-completion object%)))


Daniel



Posted on the users mailing list.