* bug#17475: 24.3.91; bug of byte-optimize-zerop
@ 2014-05-12 15:11 Shigeru Fukaya
2014-05-16 21:11 ` Shigeru Fukaya
0 siblings, 1 reply; 4+ messages in thread
From: Shigeru Fukaya @ 2014-05-12 15:11 UTC (permalink / raw)
To: 17475
`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
^ permalink raw reply [flat|nested] 4+ messages in thread
* bug#17475: 24.3.91; bug of byte-optimize-zerop
2014-05-12 15:11 bug#17475: 24.3.91; bug of byte-optimize-zerop Shigeru Fukaya
@ 2014-05-16 21:11 ` Shigeru Fukaya
2014-05-20 18:32 ` Stefan Monnier
2014-05-28 0:51 ` Stefan Monnier
0 siblings, 2 replies; 4+ messages in thread
From: Shigeru Fukaya @ 2014-05-16 21:11 UTC (permalink / raw)
To: 17475
>`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
zerop itself is not an error-free fuction.
I'll change my poroposal code.
(defun byte-optimize-zerop (form)
(cond ((numberp (nth 1 form))
(eval form))
((list '= (nth 1 form) 0))))
-- Shigeru
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-05-28 0:51 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-12 15:11 bug#17475: 24.3.91; bug of byte-optimize-zerop Shigeru Fukaya
2014-05-16 21:11 ` Shigeru Fukaya
2014-05-20 18:32 ` Stefan Monnier
2014-05-28 0:51 ` Stefan Monnier
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.