GNU bug report logs - #17475
24.3.91; bug of byte-optimize-zerop

Previous Next

Package: emacs;

Reported by: Shigeru Fukaya <shigeru.fukaya <at> gmail.com>

Date: Mon, 12 May 2014 15:12:02 UTC

Severity: minor

Found in version 24.3.91

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: tracker <at> debbugs.gnu.org
Subject: bug#17475: closed (24.3.91; bug of byte-optimize-zerop)
Date: Wed, 28 May 2014 00:52:02 +0000
[Message part 1 (text/plain, inline)]
Your message dated Tue, 27 May 2014 20:51:40 -0400
with message-id <jwvoayiohee.fsf-monnier+emacsbugs <at> gnu.org>
and subject line Re: bug#17475: 24.3.91; bug of byte-optimize-zerop
has caused the debbugs.gnu.org bug report #17475,
regarding 24.3.91; bug of byte-optimize-zerop
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)


-- 
17475: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=17475
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Shigeru Fukaya <shigeru.fukaya <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.3.91; bug of byte-optimize-zerop
Date: Tue, 13 May 2014 00:11:11 +0900
`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


[Message part 3 (message/rfc822, inline)]
From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Shigeru Fukaya <shigeru.fukaya <at> gmail.com>
Cc: 17475-done <at> debbugs.gnu.org
Subject: Re: bug#17475: 24.3.91; bug of byte-optimize-zerop
Date: Tue, 27 May 2014 20:51:40 -0400
> (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


This bug report was last modified 10 years and 359 days ago.

Previous Next


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