[racket] Passing information between syntax classes

From: Konrad Hinsen (konrad.hinsen at fastmail.net)
Date: Fri Feb 13 11:08:44 EST 2015

Ryan Culpepper writes:

 > Syntax classes can take arguments. Here’s one example, which adds a
 > parameter to bar (which is a syntax object representing a variable
 > bound to the set holding the symbols to check) and passes
 > #’foo-symbols as the argument.

Excellent, thanks! That's exactly what I wanted to do, but I didn't
get very far by studying the documentation. With your example, it looks
perfectly straightforward.

 > Of course, you can also just to the parameterization at "run time":
 > have the attribute be a function that accepts the set as an
 > argument. The expansion contains obvious beta redexes, which I’m
 > sure the Racket compiler will take care of for you. Here’s the
 > code:

That looks like a good solution as well, but I think the former one
will yield more readable expansions, which helps with debugging.

Thanks again,
  Konrad.


Posted on the users mailing list.