unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Pip Cet <pipcet@gmail.com>
To: emacs-devel@gnu.org, "Mattias Engdegård" <mattiase@acm.org>
Subject: Re: master f9d7440: ; * lisp/emacs-lisp/byte-opt.el (byte-optimize-eq): Fix last change.
Date: Tue, 20 Jul 2021 20:07:43 +0000	[thread overview]
Message-ID: <CAOqdjBdVFkwB74607ikHZfB3DX5SMmmm4bcEjXmqu8OguQqihw@mail.gmail.com> (raw)
In-Reply-To: <20210720173249.D00AF209AA@vcs0.savannah.gnu.org>

[-- Attachment #1: Type: text/plain, Size: 1113 bytes --]

On Tue, Jul 20, 2021 at 5:32 PM Mattias Engdegård
<mattiase@savannah.gnu.org> wrote:
> diff --git a/lisp/emacs-lisp/byte-opt.el b/lisp/emacs-lisp/byte-opt.el
> index 7ed04b3..c9c0ac0 100644
> --- a/lisp/emacs-lisp/byte-opt.el
> +++ b/lisp/emacs-lisp/byte-opt.el
> @@ -970,10 +970,9 @@ See Info node `(elisp) Integer Basics'."
>       form)))
>
>  (defun byte-optimize-eq (form)
> -  (byte-optimize-binary-predicate
> -   (pcase (cdr form)
> -     ((or `(,x nil) `(nil ,x)) `(not ,x))
> -     (_ form))))
> +  (pcase (cdr form)
> +    ((or `(,x nil) `(nil ,x)) `(not ,x))
> +    (_ (byte-optimize-binary-predicate form))))

I played around with simple expressions a little after this patch, and
things didn't seem quite right. The good news is they weren't quite
right without the patch, either.

I find things work better with the attached patch applied. If it is as
obviously correct as it seems to me, it should probably be applied.

But it does occur to me this code optimizes (quote) to nil. Is that
intentional? Is it worth fixing? (It also optimizes (quote 1 2 3) to
1).

Pip

[-- Attachment #2: 0001-Fix-test-in-byte-optimize-quote.patch --]
[-- Type: text/x-diff, Size: 816 bytes --]

From e31764707462ba278549aace71b699ef04127cd2 Mon Sep 17 00:00:00 2001
From: Pip Cet <pipcet@gmail.com>
Date: Tue, 20 Jul 2021 19:58:16 +0000
Subject: [PATCH] Fix test in byte-optimize-quote

*  (byte-optimize-quote): Fix condition not to be trivially false.
---
 lisp/emacs-lisp/byte-opt.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/emacs-lisp/byte-opt.el b/lisp/emacs-lisp/byte-opt.el
index c9c0ac0045..39ec5aa9fd 100644
--- a/lisp/emacs-lisp/byte-opt.el
+++ b/lisp/emacs-lisp/byte-opt.el
@@ -1077,7 +1077,7 @@ byte-optimize-concat
 (defun byte-optimize-quote (form)
   (if (or (consp (nth 1 form))
 	  (and (symbolp (nth 1 form))
-	       (not (macroexp--const-symbol-p form))))
+	       (not (macroexp--const-symbol-p (nth 1 form)))))
       form
     (nth 1 form)))
 
-- 
2.32.0


       reply	other threads:[~2021-07-20 20:07 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20210720173248.5699.35348@vcs0.savannah.gnu.org>
     [not found] ` <20210720173249.D00AF209AA@vcs0.savannah.gnu.org>
2021-07-20 20:07   ` Pip Cet [this message]
2021-07-20 21:00     ` master f9d7440: ; * lisp/emacs-lisp/byte-opt.el (byte-optimize-eq): Fix last change Mattias Engdegård
2021-07-21  9:35       ` Mattias Engdegård

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAOqdjBdVFkwB74607ikHZfB3DX5SMmmm4bcEjXmqu8OguQqihw@mail.gmail.com \
    --to=pipcet@gmail.com \
    --cc=emacs-devel@gnu.org \
    --cc=mattiase@acm.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).