[Top][All Lists]

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

Re: lexical-binding questions

From: Thierry Volpiatto
Subject: Re: lexical-binding questions
Date: Sat, 05 May 2012 17:57:40 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1.50 (gnu/linux)

Stefan Monnier <address@hidden> writes:

>> it seem C-M-x is not working as expected in a `lexical-binding' enabled
>> buffer:
>> #+BEGIN_SRC emacs-lisp
>> ;; -*- lexical-binding: t -*-
>> (defun foo ()
>>   (declare (special bar))
>>   (let ((bar 2)
>>         (baz 3))
>>     #'(lambda () (+ bar baz))))
>> ;; I expect this:
>> ;; (funcall (foo))
>> ;;=>Symbol's value as variable is void: bar
>> #+END_SRC
>> However, (funcall (foo)) return 5 until I byte-compile and load the
>> file.
> What makes you think this has something to do with C-M-x?

Nothing, I was just saying the evaluation of function is not working as
expected, i.e the behavior of the function is different if one use C-M-x
or if one compile/load code.

> AFAICT it's just a difference between interpreted and compiled code,
> because CL's (declare (special bar)) has not been adapted to
> lexical-binding.

Now we have lexical-binding in Emacs, it could be nice to implement the
declare features of CL. (inline too)

>> So my question is how do you evaluate such code when working in a
>> `lexical-binding' enabled buffer?
> You don't use (declare (special bar)).

Of course.


Get my Gnupg key:
gpg --keyserver pgp.mit.edu --recv-keys 59F29997 

reply via email to

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