I've finally documented term rewriting macros: http://build.nimrod-code.org/docs/trmacros.html
AFAIK Nimrod is the only programming language that combines a (now) hygienic macro system with term rewriting rules and sideeffect and alias analysis. So, yeah, I'm pretty proud of it. :D
They can be exported or hidden just like other symbols with the * export marker.
Indeed, this power comes with a price as TR macros are nonlocal program transformers. However there are several ways provided to tame them: You can turn them off with --patterns:off globally or for sections of code via {.push patterns: off.}. Additionally the compiler outputs each performed transformation as a hint message and idetools --usages works for them as well.
BTW the C++ alternative to term rewriting is expression templates which are inferior in every way (IMO):
TR macros can give matrixes and bignums implemented as a library the performance of built-ins! And I haven't even mentioned all the useful things you can do with them which do change program semantics... ;-) The price you pay in WYSIWYG is well worth it.
True, but blacklisting instead of whitelisting would be better:
from buggymodule import * except optBroken, optBroken2
It is generally useful and easy to implement which means on my todo now. ;-)
import buggymodule except optBroken, optBroken2
This page shows up in a web search for term rewriting macros, but the link at the top is no longer valid. Here is the correct link: