From: Lawrence Mitchell <wence@gmx.li>
To: 11686@debbugs.gnu.org
Subject: bug#11686: 24.1.50; defun should return name
Date: Wed, 13 Jun 2012 15:34:09 +0100 [thread overview]
Message-ID: <874nqfl1r2.fsf@gmx.li> (raw)
In-Reply-To: <87ipewb637.fsf@gnu.org>
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@gmx.li>
next prev parent reply other threads:[~2012-06-13 14:34 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-12 20:58 bug#11686: 24.1.50; defun should return name Johan Bockgård
2012-06-13 9:13 ` Lawrence Mitchell
2012-06-13 12:27 ` Stefan Monnier
2012-06-13 14:34 ` Lawrence Mitchell [this message]
2012-06-18 15:58 ` Stefan Monnier
2012-06-22 13:38 ` Lawrence Mitchell
2012-06-24 17:08 ` Stefan Monnier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=874nqfl1r2.fsf@gmx.li \
--to=wence@gmx.li \
--cc=11686@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).