Pascal Costanza wrote:
On 7 Sep 2010, at 23:41, Daniel Weinreb wrote:

  
It's very, very hard to know what "best macro" means.  It's
like asking for the "best function".  Perhaps what people
mean is the "cutest" or "most remarkable" macro.
    


I was rather amazed when discovering a technique for integrating hygiene-compatible macros into Common Lisp. How to do this is described here: http://www.jucs.org/jucs_16_2/embedding_hygiene_compatible_macros (In the paper, it's described in terms of Scheme, because that's easier to explain, but the 'actual' implementation is in Common Lisp, as also described more superficially in that paper, and also available for download).

I'm not sure that this is actually a practically useful approach, but it surely shows how powerful Common Lisp macros are. (Definitely more powerful than many people think.) 
It would be wonderful if, in your copious free time, you could write
a paper that expressed this: how powerful Lisp macros are.  It
would not need to be at a "peer-reviewed" sort of level; in fact,
it would ideally be written so that a Python programmer could
understand it.

I tried to write a Python vs. Common Lisp comparison once,
but it was too hard and I didn't have enough time.  The
big question is, should we look at the existing languages
like Python and Ruby that have co-opted so many of
the good features of Lisp, and declare victory and go home.
Well, Python isn't so good at using functions as objects
(I read somewhere that Guido actually wanted to
remove "map" and "reduce" and such from the language,
but got too much pushback).  Ruby, I gather, does that a
lot more.

But the real point is that you can do so much more with
macros, in all Lisps (including Clojure).  I often get told,
oh, you don't need Lisp macros; facilities in other
languages can do all the things Lisp macros can do.

Although this is wrong, there isn't any quick way to
answer the objection.  So it would be nice if there
were an easy-to-deploy explanation of why this is not
true and Lisp macros really are a unique abstraction
mechanism that's very valuable.

Unfortunately, writing this isn't easy, and all the
people who know how to do it as very busy...

-- Dan



The technique in that paper could maybe become more practically useful if it gets integrated directly in a Common Lisp implementation itself. Not that I think that macro hygiene is actually a real problem... ;)


Pascal