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

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

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


From: Andrea Corallo
Subject: bug#42147: 28.0.50; pure vs side-effect-free, missing optimizations?
Date: Wed, 08 Jul 2020 19:14:43 +0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux)

Mattias Engdegård <mattiase@acm.org> writes:

> +(defun byte-optimize--substitutable-p (expr)
> +  "Whether EXPR is a constant that can be propagated."
> +  ;; Only consider numbers, symbols and strings to be values for substitution
> +  ;; purposes.  Numbers and symbols are immutable, and mutating string
> +  ;; literals (or results from constant-evaluated string-returning functions)
> +  ;; can be considered undefined.
> +  ;; (What about other quoted values, like conses?)
> +  (or (booleanp expr)
> +      (numberp expr)
> +      (stringp expr)
> +      (and (consp expr)
> +           (eq (car expr) 'quote)
> +           (symbolp (cadr expr)))
> +      (keywordp expr)))

Hi Mattias,

in the branch I'm working I've a function similar in scope to this so
reading your patch this got my attention.

In my version I assumed (after a look to the manual) to have strings to
be immutable only at speed 3.  Is it safe to assume this always instead?

Also I wanted ask why symbols are not included but only keywords, is
this to respect the side effect of interning them or something else?

Thanks!

  Andrea

-- 
akrl@sdf.org





reply via email to

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