RFC -- HYGIENIC MACROS IN PYTHON

Courageous jkraska at san.rr.com
Thu Feb 7 20:42:51 EST 2002


>It's just that being forced -- "for my own good" -- not to use certain
>features because someone has decreed them intrinsically bad, doesn't
>appeal to me at all.

Sure. You realize that a hygienic macro doesn't prevent you from
modifying things by consequence, right? All it does is require for
you to mean it; this caters to Python's phenonomenon of least
surprise. Imagine the following

>>> i = 3
>>> j = 4
>>> mymacro i
>>> print j
5

That would vex some folks. But that's exactly what a non hygienic
macro can do. Granted, in some cases non hygeniec macros can be
quite useful. And the design I'm targeting is only _pseudo_ hygienic
in any case. It's hygienic for the local namespace. It is not,
however, hygienic for the class or the instance. A macro could
therefor modify the class or instance it is associated with, just
not the local namespace. Don't ask how I'm doing that yet, however,
it would make some of the Python implementers squeak. :)

C//




More information about the Python-list mailing list