[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#47391: 27.2; static list return from function and nconc
From: |
Stefan Monnier |
Subject: |
bug#47391: 27.2; static list return from function and nconc |
Date: |
Thu, 25 Mar 2021 11:43:20 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
>> (defun fn () '(1 2))
>>
>> (nconc (fn) '(3))
>> -> (1 2 3)
>
> This is undefined behavior/unsupported. The value that (fn) evaluates
> to is immutable, but nconc mutates it.
>
>>
>> (nconc (fn) '(3))
>> -> (1 2 3 3) ? should be (1 2 3)
>>
>> If this is not a bug, then hfy-invisible, hfy-face-to-style-i may need to be
>> fixed.
>
> If they use this pattern, then they should indeed be fixed.
Note that in the code above, we usually consider that the bug is not in
`fn` but in the use of `nconc` on a list which the code doesn't know can
safely be mutated (it should hence use `append` instead).
Stefan