trouble understanding next-method and mixins

From: Brian Denheyer <>
Date: Mon, 28 Jun 1999 22:54:36 -0700 (PDT)

When I try the code given at the end of the e-mail I get the following
results :

Welcome to the STk interpreter version 3.99.4 [Linux-2.X-ix86]
Copyright (C) 1993-1999 Erick Gallesio - I3S - CNRS / ESSI <>
deleting baz #[<baz> 80970a8]
deleting mixer #[<baz> 80970a8]
deleting foo #[<baz> 80970a8]
deleting boo #[<boo> 809499c]
deleting mixer #[<boo> 809499c]
*** Error at line 41 of file ./mix.scm:
    No next method when calling #[<generic> delete (4)]
with (#[<boo> 809499c]) as argument
Current eval stack:
  0 (error "No next method when calling ~S\nwith ~S as argument" gf args)
  1 (next-method)
  2 (next-method)

The error is pretty clear. Delete<boo> is followed by delete<mixer>
which sees a next-method and dies. Obviously stk thinks there should
be yet another gf which will take <boo>, just like when <baz> was

Although I understand the error doesn't this type of operation
severely limit the use of mixins ? After all, once I have used
<mixer> in a class, I'm stuck. I can't use it as a super class for
any other class and invoke delete on that new class or I will get the
same result that I did when trying to delete the <boo> instance. This
is all due to the next-method in delete<mixer>.

Do I need to write delete for <boo> (or <mixer>) differently somehow?
Is there some other way to invoke delete for the <mixer> super class
when deleting a <boo> object ? Do I have some larger problem in the
class designs ??

Inquiring minds want to know.



(define-class <foo> ()
  ((foo :accessor foo
        :init-keyword :foo)
   (foo1 :accessor foo1
         :initform 'foo1
         :init-keyword :foo1)))

(define-class <mixer> ()
  ((mix :accessor mix
        :init-keyword :mix
        :initform 'mix)))

(define-class <baz> (<mixer> <foo>)

(define-class <boo> (<mixer>)

(define-method delete
  ((self <foo>))
  (format #t "deleting foo ~A\n" self))

(define-method delete
  ((self <baz>))
  (format #t "deleting baz ~A\n" self)

(define-method delete
  ((self <mixer>))
  (format #t "deleting mixer ~A\n" self)

(define-method delete
  ((self <boo>))
  (format #t "deleting boo ~A\n" self)

(define x (make <baz>))
(delete x)
(define y (make <boo>))
(delete y)
Received on Tue Jun 29 1999 - 07:55:24 CEST

This archive was generated by hypermail 2.3.0 : Mon Jul 21 2014 - 19:38:59 CEST