[racket] Help: Passing a class to a macro and not an identifier

From: Laurent (laurent.orseau at gmail.com)
Date: Wed Sep 15 08:50:41 EDT 2010

Dear all,

Apparently I still don't have my macro writing licence.
I'm stuck somewhere around syntax-case and with-syntax.

Here is my problem.
Suppose something like this:

(define-syntax (class->singleton stx)
  (syntax-case stx ()
    [(_ cl)
     (with-syntax ([(name ...)
                    (interface->method-names (class->interface #'cl))]) ;
***
       #'(begin (define-something name)
                ...))]))

(class->singleton a%)

On line *** I want to match (name ...) with the list of method-names of
the given class (here a%).
Obviously, this is wrong, since #'cl is just a syntaxed identifier IIUC,
but should be the class itself.
datum->syntax and syntax->datum don't help either, so what should I do?
Any hint (even an RTFM link) would be appreciated.

Thanks,
Laurent
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20100915/6a6f536a/attachment.html>

Posted on the users mailing list.