[racket] Help: Passing a class to a macro and not an identifier
On Wed, Sep 15, 2010 at 14:57, Matthias Felleisen <matthias at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20100915/b3366aa7/attachment.html>