Announcing bytecodehacks 0.10

Michael Hudson mwh21 at cam.ac.uk
Thu May 13 06:53:23 EDT 1999


Jim Meier <fatjim at home.com> writes:

> Michael Hudson wrote:
> 
> > Michael Vanier <mvanier at bbb.caltech.edu> writes:
> >
> > > Now we can put that thread to rest for good :-)
> >
> > I wish.
> >
> > > We'll-make-python-into-scheme-yet-even-if-we-have-to-drag-it-
> > > kicking-and-screaming-all-the-way-ly y'rs,
> >
> > oh-my-wouldn't-macros-be-nice-ly y'rs
> >
> > Michae;
> 
> OOOOOOhhhhhh!!!! Scheme style macros! This could put down many, many
> arguments about python's semantics.. "You don't like having to use while 1:
> and have a better idea? Here's go the docs for Python Macros-- Go Have Fun!"
> 
> I think this would be very cool. Not like I have clue 1/100,000,00 how to do
> it. Or even what it would look like.. But Still!

Well, you can take a look at the source of bytecodehacks.setq.setqize,
which is basically a macro expansion. It would be nice if it could be
written like so:

def setq(var,value):
    var=value
    return var

macrotable={}
macrotable['setq'] = setq

def f(x):
    while setq(x,x-1):
        print x

f=macroexpand(f,macrotable)

But I'm not sure that's possible. 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). Maybe I'll d/l r5rs sometime and give it a good thinking over.

Michael

PS: congrats on being the first non-Michael to post to this thread ;-)





More information about the Python-list mailing list