Python syntax in Lisp and Scheme

Erann Gat gat at jpl.nasa.gov
Sun Oct 12 22:04:09 EDT 2003


In article <ue0ib.267972$R32.8718052 at news2.tin.it>, Alex Martelli
<aleaxit at yahoo.com> wrote:

> Let's start with that WITH-CONDITION-MAINTAINED example of Gat.  Remember 
> it?  OK, now, since you don't appear to think it was an idiotic example, 
> then SHOW me how it takes the code for the condition it is to maintain and
> the (obviously very complicated: starting a reactor, operating the reactor,
> stopping the reactor -- these three primitives in this sequence) program 
> over which it is to maintain it, and how does it modify that code to ensure
> this purpose.  Surely, given its perfectly general name, that macro does not
> contain, in itself, any model of the reactor; so it must somehow infer it 
> (guess it?) from the innards of the code it's analyzing and modifying.

It is not necessary to exhibit a theory of how WITH-CONDITION-MAINTAINED
actually works to understand that if one had such a theory one can package
that theory for use more attractively as a macro than as a function.  It
is not impossible to package up this functionality as a function, but it's
very awkward.  Control constructs exist in programming languages for a
reason, despite the fact that none of them are really "necessary".  For
example, we can dispense with IF statements and replace them with a purely
functional IF construct that takes closures as arguments.  Or we can do
things the Java way and create a new Conditional object or some such
thing.  But it's more convenient to write an IF statement.

The claim that macros are useful is nothing more and nothing less than the
claim that the set of useful control constructs is not closed.  You can
believe that or not.  To me it is self-evidently true, but I don't know
how to convince someone that it's true who doesn't already believe it. 
It's rather like arguing over whether the Standard Model of Physics covers
all the useful cases.  There's no way to know until someone stumbles
across a useful case that the Standard Model doesn't cover.

> For example, the fact that Gat himself says that if what I want to write
> are normal applications, macros are not for me: only for those who want
> to push the boundaries of the possible are they worthwhile.  Do you think
> THAT is idiotic, or wise?  Please explain either the reason of the drastic
> disagreements in your camp, or why most of you do keep trying pushing
> macros (and lisp in general) at those of us who are NOT particularly
> interested in "living on the edge" and running big risks for their own sake,
> accordingly to your answer to the preceding question, thanks.

I can't speak for anyone but myself of course, but IMO nothing worthwhile
is free of risks.  I also think you overstate the magnitude of the risk. 
You paint nightmare scenarios of people "changing the language"
willy-nilly in all sorts of divergent ways, but 1) in practice on a large
project people tend not to do that and 2) Lisp provides mechanisms for
isolating changes to the language and limiting the scope of their effect. 
So while the possibility exists that someone will change the language in a
radical way, in practice this is not really a large risk.  The risk of
memory corruption in C is vastly larger than the risk of "language
corruption" in Lisp, and most people seem to take that in stride.

> ...and there's another who has just answered in the EXACTLY opposite
> way -- that OF COURSE macros can do more than HOF's.  So, collectively 
> speaking, you guys don't even KNOW whether those macros you love so
> much are really necessary to do other things than non-macro HOFs allow
> (qualification inserted to try to divert the silly objection, already made 
> by others on your side, that macros _are_ functions), or just pretty things
> up a little bit.

But all any high level language does is "pretty things up a bit".  There's
nothing you can do in any language that can't be done in machine
language.  "Prettying things up a bit" is the whole point.  Denigrating
"prettying things up a bit" is like denigrating cars because you can get
from here to there just as well by walking, and all the car does is "speed
things up a bit".

E.




More information about the Python-list mailing list