macro FAQ

John J. Lee jjl at pobox.com
Sun Aug 24 09:11:07 EDT 2003


Jacek Generowicz <jacek.generowicz at cern.ch> writes:

> mis6 at pitt.edu (Michele Simionato) writes:
> 
> > > Can this be implemented using metaclasses, or any other existing
> > > Python mechanism ?
> > 
> > Yes.
[...]
> > At the end it uses metaclasses+exec+a simple argument parser based on 
> > tokenize. EXPERIMENTAL code, which I would not trust except as proof
> > of concept.
> 
> If it uses exec, then it is faking up macros.
> 
> Lisp macros are little else besides offering language support for the
> use of exec for this kind of thing.
> 
> If people start resorting to this sort of trick themselves, and
> re-inventing it over and over again, then you might as well design it
> properly, once and for all, and call it a macro system.
[...]

Well, as has been repeatedly argued, that's just the point: people
*don't* do that over and over again.  Who uses these 'faked-up
macros'?  A few people who like messing around with metaclasses for
fun (note Michele's warning about 'EXPERIMENTAL' and 'proof of
concept').  If it's made easier, relatively sane people might do it
too, and then we'll all suffer ;-)

I'm sure you're capable of understanding this position, but the
argument has started going round in circles.


John




More information about the Python-list mailing list