[alexandria-devel] [PATCH] PROG1-LET

Benjamin Saunders ralith at gmail.com
Sun Apr 8 21:05:25 UTC 2012


On Sun, Apr 08, 2012 at 06:24:33PM +0600, Attila Lendvai wrote:
> it's not substantially shorter than the alternatives

True. However, the same can be said of every other macro in
bindings.lisp, and this does not seem to have precluded their
inclusion. It certainly does not preclude my glad use of them.

> not a very regular pattern in my experience

Certainly this depends on the style of the code in which you are
working. Many of my uses of it pertain to interacting with foreign
libraries which are characteristically highly imperative, in ways that
Lisp often is not. Nonetheless, interacting with such libraries is
something I do often, and I do not expect I am alone in that.

> makes code less readable in cases where a simple aprog1 is not
> desirable

I'm not entirely sure what cases you're referring to. As a matter of
style, I prefer not to use macros which implicitly bind names, and
therefore make use of constructs of the sort found in bindings.lisp in
place of anaphora. Thus I would argue that aprog1 is in general never
desirable.

In cases where aprog1 is objectively unusable, such as nested forms,
then this would seem to be nearly equivalent, except that the
explicitly named binding allows unambiguous reference to be made,
which is hardly less readable.

> and it adds quite some complexity when reading the code.

This is indeed subjective. I find it to be clearer to read than the
alternatives, but perhaps that's just me? Anaphora would seem to be
widely used for a reason, though, and this is but a minor adjustment
to that same concept...
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <https://mailman.common-lisp.net/pipermail/alexandria-devel/attachments/20120408/1f76237c/attachment.sig>


More information about the alexandria-devel mailing list