[racket] unhygienic macro on purpose?

From: Robby Findler (robby at eecs.northwestern.edu)
Date: Tue Aug 3 08:07:17 EDT 2010

Why not just use the one from the teaching language instead of breaking hygiene?

Robby

On Tue, Aug 3, 2010 at 7:02 AM, Todd O'Bryan <toddobryan at gmail.com> wrote:
> I'm trying to write a macro to provide functional mutators for the
> teaching languages. Here's the main construct:
>
> (define-syntax (define-struct-with-setters stx)
>  (syntax-case stx ()
>    [(_ id fields)
>     (let ([field-names (syntax->list #'fields)])
>       #`(begin
>           (define-struct id fields #:transparent)
>           #,@(for/list ([f field-names])
>              (setter #'id field-names f))))]))
>
> Everything works, mostly. The problem is that this uses define-struct
> from #lang racket instead of the teaching language where the macro is
> invoked. (Thus, the #:transparent argument.) I know there's some way
> to get define-struct evaluated in the environment of the macro's use
> instead of its definition, but I can't get it to work.
>
> Is there a way to fix it?
>
> Thanks,
> Todd
> _________________________________________________
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/users
>


Posted on the users mailing list.