On Lisp Loop
January 23, 2015
It seems there is a strong disdain about the Common Lisp’s loop macro.
A lot of people talk about replacing it with special library iterate.
I totally do not understand it, at all.
loop syntax is the DSL.
The same method is employed in the following areas:
- Regular expressions.
 - Datetime format strings.
 printfformat strings. Even in the same Common Lisp there is aformatmacro which has its own DSL.
The main point which promotes iterate is “extensibility”.
So what?
Regular expressions are not extensible, by design.
They would not be “regular” if they were extensible.
loop is not, and should not be, extensible, by design.
If it doesn’t support objects or generic iterable containers, then it should be rewritten in the implementations, not made “extensible” by any other code.
Otherwise, the code using it will be incomprehensible.
The all-loved book “On Lisp” by Paul Graham states it on like first page: if you add your own syntax to the program, you force the maintainer to learn your language.
All this “extensible” shit is not worth a penny if it makes maintainer’s work harder.
You write not for yourself, you write for others to read.