help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Emacs 30.0 warning from `cl-pushnew' and `memql'


From: Andreas Eder
Subject: Re: Emacs 30.0 warning from `cl-pushnew' and `memql'
Date: Sun, 08 Jan 2023 19:54:31 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)

On So 08 Jan 2023 at 05:18, Emanuel Berg <incal@dataswamp.org> wrote:

> Stefan Monnier via Users list for the GNU Emacs text editor wrote:
>
>>> (let ((lst '()))
>>>   (cl-pushnew "a" lst)
>>>   (cl-pushnew "a" lst)
>>>   lst) ; ("a" "a")
>>
>> It may sometimes return ("a" "a") but it may also return
>> ("a"). Case in point, I think it will do the first when
>> interpreted and the second when compiled.
>
> What's the deal with all that, can it be explained easily?
>
> Why is it different?
>
> That's not a good thing, right? I always thought of compiled
> as just faster in execution, but computes faster ...
>
> The compiler has some optimization scheme with recurring data
> in space and time so the same data ends up at the same place
> so is just pushed once?

I'm nit sure how it is specified to work in elisp. But for common lisp
you are in undefined territory. Since '() is a constant, then after
modifying lst y are generating undefined behaviour.

'Andreas



reply via email to

[Prev in Thread] Current Thread [Next in Thread]