Announcing bytecodehacks 0.10

Tim Peters tim_one at email.msn.com
Thu May 13 11:42:58 EDT 1999


[Michael Hudson]
> ...
> I ought to point out I don't really understand macros in scheme
> (eg. I know there *is* a difference between "hygenic" and
> "unhygenic" macros, but I don't really get what it is).

Scheme macros are "structural" as opposed to e.g. C's token-based guys, so
can't create code wildly different from what the user may have expected --
they understand the full rules of the language.  They also "rename" temp
vrbls introduced by the macros so as not to shadow those non-local vrbls
referenced by the macro expansion.  IOW, all together, they act a lot like
inline functions, with the ability to leave argument expressions unevaluated
in such a way that they *will* evaluate to the same thing after expansion.

Character- or token-based macros are too stupid to do all that.

By mucking with things at the bytecode level, you get most of the good stuff
for free!  A transformation defined at the bytecode level is at the right
place to avoid confusing surface accidents with essential semantics.

hygiene-is-the-first-line-of-defense-against-disease-ly y'rs  - tim







More information about the Python-list mailing list