--- Begin Message ---
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
--- End Message ---
--- Begin Message ---
Subject: |
Re: bug#17475: 24.3.91; bug of byte-optimize-zerop |
Date: |
Tue, 27 May 2014 20:51:40 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux) |
> (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
--- End Message ---