Subject: bug#27177: 26.0.50: Macroexpanding cl-loop and friends (make-symbol usage)

From: Alex <[email-masked]>
Date: Sat, 03 Jun 2017 18:24:36 -0600

Stefan Monnier <[email-masked]> writes:

>> Stefan, why did you make the switch? Using cl-gensym would help a ton
>> with readability of cl-loop's macroexpansion.
>
> I don't consider human-readability of the result to be something that
> a macro should have to pay attention to.

I can understand that when talking about smaller macros, but loop is a
fairly complex macro, so I believe human-readability is a desirable
trait to have if feasible. It would help with debugging and overall
understanding of cl-loop.

I've browsed around for a few common loop implementations and they all
use gensym (CCL uses gentemp) and descriptive naming:

SBCL: https://github.com/sbcl/sbcl/blob/master/src/code/loop.lisp

CLISP: https://sourceforge.net/p/clisp/clisp/ci/default/tree/src/loop.lisp

CCL: https://github.com/Clozure/ccl/blob/master/library/loop.lisp

ABCL (admittedly they adapted it from SBCL):
http://abcl.org/trac/browser/trunk/abcl/src/org/armedbear/lisp/loop.lisp

I also found a CHICKEN Scheme egg for CL's loop, and it uses gensym (but
generic names, unfortunately).

If there's a good reason to not use gensym, then that's fine, but if the
problem is easy enough to work around (perhaps per-expansion counter so
that it will never realistically hit most-positive-fixnum), then I think
cl-loop should use it.