bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#11686: 24.1.50; defun should return name


From: Lawrence Mitchell
Subject: bug#11686: 24.1.50; defun should return name
Date: Wed, 13 Jun 2012 15:34:09 +0100
User-agent: Gnus/5.130006 (Ma Gnus v0.6) Emacs/24.1.50 (gnu/linux)

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>






reply via email to

[Prev in Thread] Current Thread [Next in Thread]