[Python-Dev] A Hygienic Macro System in Python?

Neil Schemenauer nas@python.ca
Mon, 18 Mar 2002 13:47:39 -0800


Tom Emerson wrote:
> Sure, here's one from Dylan, that provides a useful bit of syntactic
> sugar that makes some code easier to read:
> 
>   define macro unless
>     { unless (?test:expression) ?:body end }
>      => { if (~ ?test) ?body end }

These types of macros don't impress me.  Yes, it's a little more
convenient for the person who writes and understands the macro but its
more work for other people who have to read and maintain the code.
Instead of just reading the code they now have to lookup the definitions
of all of these cute macros.  It reminds me of '#define BEGIN {' in C.
The maintainability of code is it's most important quality, IMHO.
Macros like "unless" don't help.  If you want "unless" it should be part
of the language specification.

I get the impression that its macros like "unless" that turn Guido off
of the while idea.  See my other posts for examples of when I wished
Python had macros.

  Neil