6.1. The LOOP Facility [CLHS-6.1]

6.1.1. Iteration variables in the loop epilogue
6.1.2. Backward Compatibility

6.1.1. Iteration variables in the loop epilogue

The standard is unambiguous in that the iteration variables do still exist in the FINALLY clause, but not as to what values these variables might have. Therefore the code which relies on the values of such variables, e.g.,

(loop for x on y finally (return x))

is inherently non-portable across Common Lisp implementations, and should be avoided.

6.1.2. Backward Compatibility

There have been some tightening in the LOOP syntax between [CLtL2] and [ANSI CL], e.g., the following form is legal in the former but not the latter:

(loop initially for i from 1 to 5 do (print i) finally return i)

When CUSTOM:*LOOP-ANSI* is NIL, such forms are still accepted in CLISP but elicit a warning at macro-expansion time. When CUSTOM:*LOOP-ANSI* is non-NIL, an ERROR is SIGNALed.


These notes document CLISP version 2.41Last modified: 2006-10-13