Subject: Re: bug#63103: 30.0.50; nconc compiler optimization breaks user packages

From: Mattias Engdegård <[email-masked]>
Date: Thu, 27 Apr 2023 11:47:13 +0200

27 apr. 2023 kl. 08.37 skrev Daniel Mendler <[email-masked]>:

> This behavior is not documented explicitly. However the docstring states
> that "Only the last argument is not altered, and need not be a list".

Indeed. It's clear that this behaviour was never really intended, but also that it was a natural consequence of most Lisp implementations. For instance, Common Lisp specifies this behaviour but only did so after errata.

Although the utility of accepting dotted lists is very slight and requiring proper list for all but the last argument would have made it easier for us, this obviously needs to be a well-reasoned change if made at all. I'll remove the troublesome compiler transform right away.

> Due to symmetry reasons it is not far-fetched to assume that when
> `nconc' can be used to turn a proper list into an improper list, that
> the inverse works too.

I don't think that's a valid assumption -- when the documentation says that arguments are lists, then they should be proper lists. The behaviour for improper lists needs to be specified explicitly, in particular in this case when the function actually overwrites arbitrary information in the input, not just a terminating nil.

Thank you very much for finding this bug!