[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: macros vs. blocks





> 
> "Expressional Loops" by Richard C. Waters,
>  in the 1984 ACM Conference on Principles of Programming Languages

> See also Appendix A of CLTL2, which documents the final
> form of Richard Waters' system.  A pity it has fallen into
> relative disuse.

This was the big competitor to LOOP, back in roughly maybe
1978-1979 when we all wanted to generalize and extend Maclisp's
"new style DO".  Each approach had its own merits and demerits.
I think probably we in the LOOP camp were insufficiently sympathetic
to the merits of Waters's approach, possibly because we were
not experienced with lexical scoping, although also because
there really were a few things that it didn't do as well as
LOOP.

LOOP, by the way, is one of the few cases of a macro in which
we deliberately violated one of the (excellent!) rules that Scott McKay
enumerated recently on this list.  Namely, we ("what you mean we?",
really Dave Moon, but others of us were egging him on, so to speak)
decided to violate the usual stricture that a Lisp special form
should only have a symbol as the first element of the list, and
that subsequent "syntax" within the special form should be done
entirely in terms of the nested list structure.

After all, we
were the ones who had introduced keyword arguments into Lisp.
Those were symbols used at runtime in a sort of syntactic way.
Here we went the next step further and used symbols at "compile
time", i.e. statically, i.e. syntactically (e.g. you did not
have to use QUOTE), as keywords.  So we created one of the first
Lisp special forms to be keyword-oriented, and I think it may
be the only such special form that was accepted in Common Lisp.

(And it was only accepted after very bloody battles were fought,
as Guy Steele knows better than anyone else, since he was the
referee of those battles!)

LOOP was not as much of a success as we had hoped.  To this day
I firmly stick by our decision to use keywords.  All rules have
their exceptions, and this was a case where the benefit of using
keywords outweighed the cost of using unusual syntax.  The use
of keywords is NOT what was wrong with LOOP.

Rather, the problem with LOOP was that it turned out to be
hard to predict what it would do, when you started using a
lot of different facets of LOOP all together.  This is a
serious problem since the whole idea of LOOP was to let you
use many facets together; if you're not doing that, LOOP
is overkill.  Moon struggled hard to make LOOP more predictable
and understandable.  Even at the time I did not fully comprehend
all the issues; now, over 20 years later, I've almost forgotten
them.  But if Dave Moon could not figure out how to solve the
problem, I am quite confident that it's a very hard problem to
solve.

All of which makes me want to give Waters's work a second look.

And Waters has since done a Java version!  Waters, these days,
is CEO of Mitsubishi Electronics Research Labs (MERL, www.merl.com),
but evidently he gets some time to do technical work as well,
or at least he did at one time.  Unfortunately I cannot find
a citation for the Java work but we could ask him if anyone
is seriously interested.