Would this help you:
#lang racket (define a% (class object% (init-field this.x) (define/public (foo x) (set! this.x x)) (define/public (bar) this.x) (super-new))) (new a% [this.x 10]) (define (generic-methods class%) (map (lambda (name) (list name (make-generic class% name))) (interface->method-names (class->interface class%)))) (generic-methods a%) On Sep 15, 2010, at 9:10 AM, Laurent wrote: > > > On Wed, Sep 15, 2010 at 14:57, Matthias Felleisen <matth...@ccs.neu.edu> > wrote: > > Can we start from something simpler? > > The name of your macro suggests that you want something like this: > > (define one-and-only-one-instance > (new (class my-super% ...))) > > This creates a class and creates a single instance. Because class is nested > in the call to new, there is no way to get another instance. > > Would this be what you want? > > Okay, let me explain what I want to do (the name is not really set in stone > yet). > > There is a class a% defined somewhere, and an instance parameter > current-a%-object of class a%. > Suppose a% has methods foo and bar. > > Then I call: > (class->singleton a% current-a%-object) > > This is supposed to define the forms (foo ....) and (bar ....) so that they > act like > (send (current-a%-object) foo ....), etc. > > I want to build these definitions automatically from the methods of the class. > > Anyway, beside the intended goal, I'd still like to know how solve the macro > issue. > _________________________________________________ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/users