Subject: bug#17475: closed (Re: bug#17475: 24.3.91; bug of byte-optimize-zerop)

From: [email-masked] (GNU bug Tracking System)
Date: Wed, 28 May 2014 00:52:03 +0000

Your bug report

#17475: 24.3.91; bug of byte-optimize-zerop

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
17475: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=17475
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#17475: 24.3.91; bug of byte-optimize-zerop
From: Stefan Monnier <[email-masked]>
To: Shigeru Fukaya <[email-masked]>
Cc: [email-masked]
Date: Tue, 27 May 2014 20:51:40 -0400
List-Id: <debbugs-submit.debbugs.gnu.org>

> (defun byte-optimize-zerop (form)
>   (cond ((numberp (nth 1 form))
>          (eval form))
> 	((list '= (nth 1 form) 0))))

I simplified as suggested and turned it into a compiler-macro.
Thank you for paying attention to details.

        Stefan

Subject: 24.3.91; bug of byte-optimize-zerop
From: Shigeru Fukaya <[email-masked]>
To: [email-masked]
Date: Tue, 13 May 2014 00:11:11 +0900
List-Id: <debbugs-submit.debbugs.gnu.org>

`byte-optimize-zerop' is badly implemented.  Even when
`byte-compile-delete-errors' is non-nil, bute-compiled code may
signal an error.
(= FORM 0) and (zerop FORM) are functionally equal, besides, the
former is better when byte-compiled.

The following is the poor alternative.
I can't make a smart code without creating a new function.

(defun byte-optimize-zerop (form)
  (cond ((numberp (nth 1 form))
         (eval form))
        (byte-compile-delete-errors
         `(and (member ,(nth 1 form) (quote 0 0.0))) t)
        ((list '= (nth 1 form) 0))))

-- Shigeru