In case any lurkers like me are interested. http://blog.racket-lang.org/2011/04/writing-syntax-case-macros.html
Stephen On Tue, Apr 5, 2011 at 12:51 AM, Robby Findler <ro...@eecs.northwestern.edu>wrote: > On Mon, Apr 4, 2011 at 6:25 PM, Eli Barzilay <e...@barzilay.org> wrote: > > Four hours ago, Robby Findler wrote: > >> > >> It looks like a great macro essay for a certain crowd (altho the > >> essay seems to insult that selfsame crowd; perhaps you are assuming > >> that that crowd is into S&M?). > > > > Where's the insult? (I didn't mean any insult -- the only thing I can > > think of is the "nostalgia" reference, which is not an insult but the > > often expressed sentiment for "a simple system, like `defmacro'".) > > Well, the scare quotes are a way to put down things, generally speaking. > > > > >> Some comments: > >> > >> - I probably would have used #` in the second while macro. Yes, I > >> see you mention it later, but doing it at that point seems to fit > >> with what the reader's been given at that point > > > > Well, that's one point where the purpose of the document is different > > from a generic guide: my main goal was to write a quick intro to > > people who are familiar with `defmacro' -- so I wanted to make it very > > clear that it's the same kind of thing, only with wrapped sexprs > > instead of raw ones. In this case, I think that the long route is > > better -- it shows that the extra tools (like #`) make things easier > > only after you're aware of what goes on (and the fact that there's no > > complicated magic involved, which is the frequent complain against > > `syntax-case'). > > Yes, and the second while macro is a fine place to say that, in my > opinion. Indeed, it seems like the most natural point to go to next > and then to continue later to say what is happening with the # on the > front. This is just how your text is already building (in a good way > imo). > > > > >> - it would be good if you did some kind of a computation at compile > >> time, preferably to demonstrate an interesting computation one > >> should want to do at compile time. Maybe a macro that embeds a > >> formatted source location into its output? > > > > Good idea, I'll add something. > > > > > >> - cpp macros are, I believe, based on lexemes, not strings (so you > >> cannot have an unclosed string in a macro or something). > > > > Yeah, I couldn't find a way to phrase it better than stick a random > > "roughly" in. Using "lexemes" is a good word to describe it, but it's > > a little too opaque -- any ideas for something more light? > > "lexical tokens, like strings, parens, ..."? > > > > >> At least nowadays they are. > > > > Yes -- I definitely have used `#define's with a double-quote opener. > > I think you can still pass an arg to gcc to get the old behavior back. > > Robby > > _________________________________________________ > For list-related administrative tasks: > http://lists.racket-lang.org/listinfo/users >
_________________________________________________ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/users