>>>> "Y" == Yoshiki Hayashi
<yoshiki(a)xemacs.org> writes:
Y> (put 'concat 'byte-optimizer 'byte-optimize-concat)
Y> (defun byte-optimize-concat (form)
Y> (let ((args (cdr form))
Y> (constant t))
Y> (while (and args constant)
Y> (or (byte-compile-constp (car args))
Y> (setq constant nil))
Y> (setq args (cdr args)))
Y> (if constant
Y> (eval form)
Y> form)))
Y> With this optimze on, byte-compiled (concat "1" "2")
Y> produces new object on only first evaluation. Now I have
Y> some time to hack XEmacs again and going to submit above
Y> optimization, I'd like to change (concat "1" "2") to
Y> (concat "1" (number-to-string 2)). Martin, what do you
Y> think?
Looks good to me.
Martin