GNU bug report logs - #42147
28.0.50; pure vs side-effect-free, missing optimizations?

Previous Next

Package: emacs;

Reported by: Andrea Corallo <andrea_corallo <at> yahoo.it>

Date: Tue, 30 Jun 2020 22:28:02 UTC

Severity: normal

Found in version 28.0.50

Done: Mattias Engdegård <mattiase <at> acm.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Philipp Stephani <p.stephani2 <at> gmail.com>
Cc: Mattias Engdegård <mattiase <at> acm.org>, Paul Eggert <eggert <at> cs.ucla.edu>, Andrea Corallo <andrea_corallo <at> yahoo.it>, 42147 <at> debbugs.gnu.org
Subject: bug#42147: 28.0.50; pure vs side-effect-free, missing optimizations?
Date: Sat, 25 Jul 2020 17:09:42 -0400
> I don't think we can really do that, as that would allow the byte
> compiler to introduce bugs in the code, right? The manual states that
> "This function [concat] always constructs a new string that is not
> ‘eq’ to any existing string" so I don't see how it could ever be pure.

And yet, `concat` has been marked as "pure" even before we introduced
the notion of pure.  More specifically, the code in byte-opt.el which
optimizes calls to pure functions was originally written exclusively for
`concat`:

    commit 79d137ffe7dac5fe3041b4916c715f4ce91143af
    Author: Karl Heuer <kwzh <at> gnu.org>
    Date:   Mon Nov 3 03:58:23 1997 +0000
    
        (byte-optimize-concat): New function.

followed by:

    commit e856a453a1c1ce1907b3b582841bce3e9cff8cec
    Author: Stefan Monnier <monnier <at> iro.umontreal.ca>
    Date:   Mon Mar 22 15:21:08 2004 +0000
    
        (byte-compile-log-lap, byte-compile-inline-expand): Use backquote.
        (byte-optimize-pure-func): Rename from byte-optimize-concat.
        (symbol-name, regexp-opt, regexp-quote): Mark as pure.


-- Stefan





This bug report was last modified 4 years and 282 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.