You may wish to read this write-up on the Racket blog: http://blog.racket-lang.org/2011/04/writing-syntax-case-macros.html
On Jul 14, 2011, at 8:58 AM, Markku Rontu wrote: > Hi Thomas, > > Thanks, this is a very interesting topic to me, and I'm glad someone "did > bite" :) > > On Thu, Jul 14, 2011 at 2:35 PM, Thomas Chust <ch...@web.de> wrote: > Markku Rontu wrote: > > [...] > > On the topic of macros, I find it a bit confusing that to metaprogram in > > Racket, I must use such a different language of macros (with > > syntax-rules et al.), instead of being able to manipulate common data > > structures with plain old Racket functions. > > [...] > > Hello, > > this is not really true. The domain specific languages of syntax-rules > and syntax-case macro transformers exist purely for your convenience. > You can always manipulate syntax objects directly, all the necessary > procedures are available and documented in section 11 of the Racket > reference manual. > > > I'm sure the section 11 does go through the relevant issues, but doesn't feel > like a good introduction to the matter. I can theorise that I can manipulate > these syntax objects with plain old functions but nowhere does it seem to > show a complete useful case. What I'm missing is an example that contains all > the bits but that is not as complicated like the Racket sources themselves. > Maybe I just didn't find it? > > > [...] > > The approach in Clojure, > > that the code is just a common data structure, easily manipulatable with > > Clojure code, is intriguing. > > [...] > > The approach taken by Clojure and Common Lisp looks simple but lacks > support for hygienic macros and is therefore error prone and actually > not at all simple, if not impossible, to use correctly. > > > It's simple, it's been explained countless times, it works in many cases. > This thread started because this kind of an approach was used. It happens. So > where to point people to learn "do it right"? Like I said, using syntax-rules > makes the macro code look awfully complicated to me unless it's simple > pattern matching. So where to go to the next level? > > While Clojure *mitigates* the problems of non-hygienic macros using > namespaces and a shorthand syntax for freshly generated identifiers, it > doesn't *solve* the problems. Racket's macro system, on the other hand, > does solve the problems and since that involves some heavy lifting, it > may seem more complicated at first glance. > > > I think, to advertise that Racket has the most advanced macro system, > requires some additional educational material in the form of tutorials on > more things than just the old syntax-rules et al. I think Clojure & CL macros > have appeal because they are trivial to explain and have been explained > countless times already. Some piece is still missing from Racket side. Ok, > there are technical manuals and papers but what about some hands-on articles? > The material about going from the basic, old traditional macros to the Racket > macros and syntax is not there or it's not found easily. > > I'm sure everybody is busy on their own pet problems, extolling the virtues > of Racket to the world may sometimes have to wait. Take this rant as a > encouragement to spend some time educating people like me :) > > -Markku > > Ciao, > Thomas > > > -- > When C++ is your hammer, every problem looks like your thumb. > > _________________________________________________ > For list-related administrative tasks: > http://lists.racket-lang.org/listinfo/users
_________________________________________________ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/users