No macros in Python

Anders J. Munch andersjm at inbound.dk
Mon Dec 16 17:07:45 EST 2002


"Mike Meyer" <mwm at mired.org> wrote:
> "Anders J. Munch" <andersjm at dancontrol.dk> writes:
> > "Mike Meyer" <mwm at mired.org> wrote:
> > > Macros are a general-purpose mechanism. There are lots of things they
> > > let you do. Lazy evaluation, infinite lists, CLOS, short-circuit
> > > booleans, and so on.
> > No, s-expressions buy you those things, not macros.  Macros don't
> > provide expressiveness, they provide speed and some convenience, say
> > to let you write:
>
> Since I can do those things with macros and without s-expressions, I
> disagree. Well, maybe not CLOS.

Obviously anything that can be done with a function can be done with a
macro (just delegate to the function;->).  What's interesting is what
can be done with a macro that can't be done with a function.

How do you do lazy evaluation with macros?  And infinite lists?  Since
any particular macro expansion can only be of finite length, I presume
that closures and setc*r are doing the real work.

Lazy-eval-in-C-#define LAZY(e) RunHaskellInterpreter(#e)-ly y'rs, Anders






More information about the Python-list mailing list