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

From: Laurent (laurent.orseau at gmail.com)
Date: Thu Sep 16 05:38:23 EDT 2010

On Wed, Sep 15, 2010 at 19:35, Matthias Felleisen <matthias at ccs.neu.edu>wrote:

> On Sep 15, 2010, at 1:33 PM, Laurent wrote:
> >
> > This hack will have limitations,
> >
> > Do you have specific ones in mind?
> >
> > but you could take this one step
> > further by having the argument to your macro be an identifier and then
> > taking the symbolic name of the identifier and passing that to
> > dynamic-require (at compile time) to get the actual class you want.
> >
> > That is a nice idea, I'll try that.
> How else do you ensure that the object is an instance of the class? But
> yes, I am stumped and surprised.

Without that, I don't, that's right, though no more than does `send'.
I could had a check before the call to class->singleton or instead
of asking for an expression that generates an object of class%,
I could only ask for the arguments to `new', but this would be too
restrictive I think.

But I'm wondering if multiple calls to define-class->singleton would
then cause multiple calls to dynamic-require, which would take too
much time... ?

Another question: If I use:
(datum->syntax #'id n #'id #'id #'id)
that makes check-syntax say that `get-the-val' comes from `current-a'.
Is this ok or is there anything better to do?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20100916/ff6891be/attachment.html>

Posted on the users mailing list.