[plt-scheme] Classes, super and apply

From: Dave Gurnell (d.j.gurnell at gmail.com)
Date: Thu Dec 7 12:30:51 EST 2006

Dear All,

Is there any way to use "apply" on the "super" and "this" forms in a  
class? I'm thinking of something like the following:

     (require (lib "class.ss")
              (lib "kw.ss"))

     (define a%
       (class* object% ()
         (public my-method)

         (define my-method
           (lambda/kw (#:key [a #f] [b #f])
             (list a b)))


     (define b%
       (class* a% ()
         (override my-method)

         (define my-method
           (lambda/kw (#:key [c #f] [d #f] #:other-keys+body other)
             (append (apply super other) (list c d))))


     (send (make-object b%) my-method #:a 1 #:b 2 #:c 3 #:d 4)

you can't do this, of course, because "super" is syntax.


-- Dave

Posted on the users mailing list.