emacs-devel
[Top][All Lists]
Advanced

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

Re: Trouble with lexical-binding.


From: Nicolas Richard
Subject: Re: Trouble with lexical-binding.
Date: Thu, 16 Apr 2015 19:34:39 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

Stefan Monnier <address@hidden> writes:
> But if you have a file foo.el with
>
>    ;;; - lexical-binding:t -*-
>    (defun foo (x)
>      (let ((ptr x))
>        (lambda (y) (+ ptr y))))
>
> and a file bar.el with
>
>    ;;; - lexical-binding:t -*-
>    (defvar ptr)
>    (defun bar ()
>      (let* ((ptr 6)
>             (f (foo 3)))
>        (message "%S" (funcall f 1))))
>
> Then
>
>     emacs -Q --batch -l ~/tmp/foo.elc -l ~/tmp/bar.el --eval '(bar)'
> and
>     emacs -Q --batch -l ~/tmp/foo.el -l ~/tmp/bar.el --eval '(bar)'
>
> won't give you the same answer :-(

I can't reproduce : I get 7 in both cases. (I used "emacs --batch -f
batch-byte-compile foo.el" to get foo.elc.)

If I fix the first line of these files to actually use lexbind like so:
;;; -*- lexical-binding:t -*-
and recompile, I then get 4 in both cases.

Did I miss something ?

-- 
Nicolas



reply via email to

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