GNU bug report logs -
#11686
24.1.50; defun should return name
Previous Next
Reported by: Johan Bockgård <bojohan <at> gnu.org>
Date: Tue, 12 Jun 2012 21:02:02 UTC
Severity: normal
Found in version 24.1.50
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
Stefan Monnier wrote:
>> Here's a patch, think this is right:
>> Return NAME, not definition from defun and defmacro
>> * lisp/emacs-lisp/byte-run.el (defun, defmacro): Return newly created
>> definition's name, not its definition.
> I wonder what is the impact on the generated byte-code.
If the name is thrown away, there's no impact afaict. If you
assign the name to something there's a small increase.
Here's an example before and after for
(defvar foo (defun foo (&rest x) x))
Before:
(defvar foo (defalias 'foo #[(&rest x) "^H\207" [x] 1]))
After:
(defvar foo (byte-code "\300\301\300\302\"\210\207" [foo defalias #[(&rest x) "^H\207" [x] 1]] 4))
> Maybe a simpler way is to change defalias to return the name rather than
> the value.
But defalias says:
| (defalias SYMBOL DEFINITION &optional DOCSTRING)
| Set SYMBOL's function definition to DEFINITION, and return DEFINITION.
So you'll probably then get a bug report about that instead.
Cheers,
Lawrence
--
Lawrence Mitchell <wence <at> gmx.li>
This bug report was last modified 13 years and 30 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.