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

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

Re: Purpose of dash # in elisp


From: Lennart Borgman
Subject: Re: Purpose of dash # in elisp
Date: Mon, 9 Nov 2009 18:27:53 +0100

On Mon, Nov 9, 2009 at 2:00 PM, Pascal J. Bourguignon
<address@hidden> wrote:
>
> (first ' #'x) --> function
> (first '  'x) --> quote
>
> It happens that in emacs lisp, function and quote evaluate the same:
> they both return their unevaluated argument unchanged.
>
> However, when compiling, they don't behave the same.  function means
> that the argument is CODE, while quote says that the argument is DATA.
>
> (disassemble (byte-compile (lambda ()  '(lambda (x) (+ x x)))))
> produces:
>
> byte code:
>  args: nil
> 0       constant  (lambda (x) (+ x x))
> 1       return
>
>
>
> (disassemble (byte-compile (lambda ()  #'(lambda (x) (+ x x)))))
> produces:
>
> byte code:
>  args: nil
> 0       constant  <compiled-function>
>      args: (x)
>    0       varref    x
>    1       dup
>    2       plus
>    3       return
>
> 1       return
>
>
> When the lambda form is quoted, it is considered data, and the
> compiler doesn't compile it, but when it's function'ed, it is
> considered code, and it is compiled too.


Is this a bug, or?




reply via email to

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