18 Apr 2002
(updated 18 Apr 2002 at 15:54 UTC) »
: While important, the main use of macros is not efficiency, so much as ability to manipulate syntax. The main application I find myself using macros for, and crucial to the `little languages' approach, is the ability to control the environment in which computations are performed. Think about the let special form, which since R5RS is defined using macros in terms of lambda. The body of the let is not evaluated in the environment in which the let occurs (which is the only option with normal functions), but in a new environemnt which has a set of variables defined in it.
Paul Graham's `On lisp' has a pretty good, well-motivated, introduction to macros in Common LISP. A nice thing when using Scheme's syntax-rules is that this is a hygienic macro system so that you don't need to worry about the variable capture that happens in Common LISP.
Last thing: I'm interested in your ideas about debugging. What do you mean by hidden macros? Do you mean redefining normal features of the language, like define, etc. to include tests and traces?
bjf: English has its tricky bits: english has lots of compound verbs that sound like good, simple english, but in fact are completely new usages with a somewhat complex grammar, such as `She was put off by his tacky t-shirt', `They set out to destroy the evidence', etc. Gender is a real nuisance, but I don't think case is all that bad: it's a bit of a pain when one first learns the language, but it's quite well behaved, and when you've learnt it, that's it. And when you are comfortable with case, you find it gives you some opportunities to improve the way you put things.
sej: I wasn't saying I agreed with the Economist article, actually I think the last thing the Middle East needs is a heavy handed US intervention, but what I found interesting about the article is that the authors don't think peace between Israel and Palestine is hopeless. Do you think a UN-led peacekeeping force would have any chance? I have to say I am pessimistic.