Subject: Re: bug#42147: 28.0.50; pure vs side-effect-free, missing optimizations?

From: Andrea Corallo <[email-masked]>
Date: Sun, 05 Jul 2020 13:16:13 +0000

Mattias Engdegård <[email-masked]> writes:

> 4 juli 2020 kl. 18.13 skrev Andrea Corallo <[email-masked]>:
>
>> (defun bbb ()
>>   (let ((x (list 1 2)))
>>     (f x)        ; f is not pure
>>     (1+ (car x)) ; <= cannot optimize
>>     ))
>
> (A more precise property for 'f' in your examples would be 'side-effect-free' rather than 'pure'.)

Right good point!

>> BTW reading the code of the native compiler I realized I am already
>> extrapolating for use a very similar list of optimizable functions to the one
>> proposed.  I still think would quite cleaner to classify these in
>> byte-opt.el.
>
> Certainly, but be sure to state your criteria with clarity. There must be no doubt whether or not a function should have a certain property!

Absolutley, actually part of the scope of the patch in discussion (for
me) is exactly this given I'll just fetch this as a definition.

Thanks for improving the patch!

  Andrea

-- 
[email-masked]