<br><br><div class="gmail_quote">On Wed, Sep 15, 2010 at 14:57, Matthias Felleisen <span dir="ltr"><<a href="mailto:matthias@ccs.neu.edu">matthias@ccs.neu.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<br>
Can we start from something simpler?<br>
<br>
The name of your macro suggests that you want something like this:<br>
<br>
(define one-and-only-one-instance<br>
(new (class my-super% ...)))<br>
<br>
This creates a class and creates a single instance. Because class is nested<br>
in the call to new, there is no way to get another instance.<br>
<br>
Would this be what you want?<br></blockquote><div><br>Okay, let me explain what I want to do (the name is not really set in stone yet). <br></div></div><br>There is a class a% defined somewhere, and an instance parameter <br>
current-a%-object of class a%.<br>Suppose a% has methods foo and bar.<br><br>Then I call:<br>
(class->singleton a% current-a%-object)<br><br>This is supposed to define the forms (foo ....) and (bar ....) so that they act like<br>(send (current-a%-object) foo ....), etc.<br><br>I want to build these definitions automatically from the methods of the class.<br>
<br>Anyway, beside the intended goal, I'd still like to know how solve the macro issue.<br><br>