Re: Announcement Loop Facility
Lassi Kortela 16 Aug 2022 09:03 UTC
> a SRFI specifying an extensible loop facility, inspired by Common
> Lisp's loop facility, Emacs' cl-loop, and Taylor R. Campbell's
> implementation of foof-loop.
The fundamental problem with CL loop is that it ties together three
orthogonal things in such a way that they cannot be pulled apart:
(1) looping combinators
(2) a non-nested style for binding/executing Lisp forms sequentially
(3) a parenthesis-free, SQL-like notation for (2)
Feature (1) is a very good fit for Lisp / functional programming and is
nice to have.
One of Lisp's best features is that scopes are clearly indicated by
nesting: (let ((foo ...)) (let ((bar ...)) etc...)). Feature (2)
flattens the nesting, which makes the scoping harder to understand and
is non-lispy. This is especially problematic when part of a macro
expansion. However, Lisp already has let* which does a similar thing.
Feature (3) essentially embeds an ALGOL/SQL style sublanguage into Lisp.
That's something one can do, but IMHO is so un-lispy that it's unfit for
inclusion in a Lisp standard. And in CL loop's case, this sublanguage is
not a general notation but is restricted to a few built-in looping
constructs: it is used only to implement (1) and (2) and cannot be
leveraged by CL users for general purpose programming.
foof-loop looks much cleaner than CL loop. It has (1) and (2) but not (3).
IMHO the following is the ideal breakdown of the problem for
standardization efforts:
(1) is unquestionably useful and probably not very controversial.
(2) should be treated with caution. Nesting should be flattened in a way
that is as symmetrical to let* as possible.
(3) should be off the table; that problem should be relegated to one of
the many infix Lisp efforts, and should be a general-purpose syntax, not
just for looping.