What's better about Ruby than Python?
a.schmolck at gmx.net
Tue Aug 19 00:37:34 CEST 2003
Harry George <harry.g.george at boeing.com> writes:
> In the Lisp world, you use the hundreds of macros in CL becuase they
> *are* the language. But home-grown (or vendor supplied) macros are
> basically a lockin mechanism. New syntax, new behavior to learn, and
> very little improvement in readability or efficiency of expresison
> (the commmon rationales for macros).
How can you claim with a straight face that the sophisticated object, logic
programming, constraint programming, lazy evaluation etc systems people have
developed in scheme and CL over the years have brought "very little
improvement in readability or efficiency"?
> The python language is just fine as is.
No it isn't. Like every other language I know python sucks in a variety of
ways (only on the whole, much less so), but I don't claim I know how to fix
this with a macro system. I'm just not sure I buy Alex's argument that an
introduction of something equivalent in expressive power to say CL's macro
system would immediately wreck the language.
The trick with adding expressiveness is doing it in a manner that doesn't
invite abuse. Python is doing pretty well in this department so far; I think
it is easily more expressive than Java, C++ and Perl and still causes less
headache (Perl comes closest, but at the price of causing even greater
headache than C++, if that's possible).
> If you really, really need something like a macro, consider a template body
> which is filled in and exec'd or eval'd at run time.
I've actually written a library where most of the code is generated like this
(and it works fine, because only trivial code transformation are needed that
can be easily accomodated by simple templating (no parsing/syntax tree
But show me how to write something like CL's series package that way (or
better yet, something similar for transforming array and matrix manipulations
from some reader-friendly representation into something efficient).
More information about the Python-list