What's better about Ruby than Python?
ktilton at nyc.rr.com
Thu Aug 21 16:20:18 CEST 2003
Andrew Dalke wrote:
> Olivier Drolet:
>>Macros don't cause Common Lisp to fork
>>anymore than function or class abstractions do.
> Making new words don't cause Speech to fork any more than
> making new sentences does.
Hunh? This one doesn't work, and this is the one you have to answer.
Forget argument by analogy: How is a macro different than an API or
class, which hide details and do wonderful things but still have to be
mastered. Here's an analogy <g>: I could learn Java syntax in a week,
but does that mean I can keep up with someone who has been using the
class libraries for years? Nope.
And Java doesn't even have macros.
> In short, no one is denying that the ability to create new macros is
> a powerful tool, just like no one denies that creating new words is
> a powerful tool. But both require extra training and thought for
> proper use, and while they are easy to write, it puts more effort
> for others to understand you. If I stick to Python/English then
> more people can understand me than if I mixed in a bit of Erlang/
> Danish, *even* *if* the latter makes a more precise description
> of the solution.
One of the guys working under me had no respect for readability, he just
got code to work, which was nice. I once had to work on his code. In
about half an hour, with the help of a few macros, a great honking mass
of text which completely obfuscated the action had been distilled to its
essense. One could actually read it.
Of course every once in a while you would notice something like "Ndiya",
but if you went to the macrolet at the top of the function you would
just think "oh, right" and get back to the code.
Maybe sometimes these macros could be functions, but then I'd just
call the function Ndiya.
So what is the difference?
btw, I am on your side in one regard: the LOOP macro in Lisp has
phenomenally un-Lispy syntax, so I have never used it. I am slowly
coming around to it being more useful than irritating, but I did not
like having a new /syntax/ invented. (LOOP /can/ be used with
conventional syntax, but I have seen such code only once and I think I
know why they broke the syntax. <g>). So I get that point, but normally
macros do not deviate from standard Lisp synatx.
"Career highlights? I had two. I got an intentional walk from
Sandy Koufax and I got out of a rundown against the Mets."
-- Bob Uecker
More information about the Python-list