From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Nicolas Richard Newsgroups: gmane.emacs.devel Subject: Re: Trouble with lexical-binding. Date: Thu, 16 Apr 2015 19:34:39 +0200 Message-ID: <87d234nfio.fsf@yahoo.fr> References: <20150413220317.GC6324@acm.fritz.box> <87h9shec3s.fsf@yahoo.fr> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1429205714 19131 80.91.229.3 (16 Apr 2015 17:35:14 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 16 Apr 2015 17:35:14 +0000 (UTC) Cc: Nicolas Richard , emacs-devel@gnu.org, Alan Mackenzie To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Apr 16 19:34:58 2015 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Yingn-0004u6-9X for ged-emacs-devel@m.gmane.org; Thu, 16 Apr 2015 19:34:57 +0200 Original-Received: from localhost ([::1]:37957 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yingm-00087H-Jf for ged-emacs-devel@m.gmane.org; Thu, 16 Apr 2015 13:34:56 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44866) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yingb-000872-D7 for emacs-devel@gnu.org; Thu, 16 Apr 2015 13:34:46 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YingX-0001NO-Sl for emacs-devel@gnu.org; Thu, 16 Apr 2015 13:34:45 -0400 Original-Received: from mailrelay116.isp.belgacom.be ([195.238.20.143]:59596) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YingX-0001N8-MW for emacs-devel@gnu.org; Thu, 16 Apr 2015 13:34:41 -0400 X-Belgacom-Dynamic: yes X-Cloudmark-SP-Filtered: true X-Cloudmark-SP-Result: v=1.1 cv=Ax9Kd9og7W2htzcJF9odWb+87PP6pPoG1t8Q07ebhfo= c=1 sm=2 a=a4K5GIyuExAA:10 a=ig_w1NEatQdLKrNY_y8A:9 Original-Received: from 239.187-177-91.adsl-dyn.isp.belgacom.be (HELO LDLC-portable) ([91.177.187.239]) by relay.skynet.be with ESMTP; 16 Apr 2015 19:34:40 +0200 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 195.238.20.143 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:185499 Archived-At: Stefan Monnier 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