[plt-scheme] Macros which expand to uses of (call-next-method)

From: Eli Barzilay (eli at barzilay.org)
Date: Mon Jun 26 02:24:49 EDT 2006

On Jun 23, Will Farr wrote:
> [...]
> If I don't introduce call-next-method with datum->syntax-object, I
> get errors about call-next-method being undefined.  Is there *any*
> context I can use to introduce call-next-method so that this works,
> or am I just hosed?

I don't know why you'd get that -- it would be helpful if you can
synthesize a minimal example.  I tried the following which worked

=> (defclass <a> ())
=> (defmethod (foo (x <a>)) (printf "a\n"))
=> (define-syntax deffoo
     (syntax-rules ()
       [(_ <c>) (defmethod (foo (x <c>)) (printf ">>> ~s\n" '<c>) (call-next-method))]))
=> (defclass <b> (<a>))
=> (deffoo <b>)
=> (foo (make <b>))
>>> <b>
=> (defclass <c> (<b>))
=> (deffoo <c>)
=> (foo (make <c>))
>>> <c>
>>> <b>

          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                  http://www.barzilay.org/                 Maze is Life!

Posted on the users mailing list.