From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Thierry Volpiatto Newsgroups: gmane.emacs.devel Subject: Re: lexical-binding questions Date: Sat, 05 May 2012 17:57:40 +0200 Message-ID: <87y5p64o3v.fsf@gmail.com> References: <871umzrvfw.fsf@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1336233477 31837 80.91.229.3 (5 May 2012 15:57:57 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 5 May 2012 15:57:57 +0000 (UTC) Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat May 05 17:57:56 2012 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 1SQhMn-0000yw-Nx for ged-emacs-devel@m.gmane.org; Sat, 05 May 2012 17:57:53 +0200 Original-Received: from localhost ([::1]:58154 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SQhMn-0001Gx-70 for ged-emacs-devel@m.gmane.org; Sat, 05 May 2012 11:57:53 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:56087) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SQhMk-0001Ao-Gw for emacs-devel@gnu.org; Sat, 05 May 2012 11:57:51 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SQhMi-0000un-5Q for emacs-devel@gnu.org; Sat, 05 May 2012 11:57:50 -0400 Original-Received: from mail-wi0-f169.google.com ([209.85.212.169]:33528) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SQhMh-0000tj-Tg for emacs-devel@gnu.org; Sat, 05 May 2012 11:57:48 -0400 Original-Received: by wibhm17 with SMTP id hm17so1906983wib.0 for ; Sat, 05 May 2012 08:57:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-type; bh=Pc2yTIJnrJlB9+vkfXVj7tGcemUIMLTN7TWG6PTLnRE=; b=jfVkJaUce+vQieT4ctKjukI5cAorkIIhTbZCQ6SZ8VeFQfxcmp2g8GcmrPaUgzIpuI yqJ6UPFNmT2yF9JFLcj90jYbeBJAHd486Aj06JzsDNixmGac6DWvoay6YA5CDGCZ0/9f NGm79p0kvWdIx3i5o6omOCWc8s0Sv8UjTz9I6Amm2L6+LDRGwKtSNZU73MYRDb5XwXN4 gEPHBqo/iw8UaNEDb5Y3SltRDfpVLCjwsntzduPfEdl50/pcZ3pVK8J2yg+VUZyBZhY7 1BdPMULlVXnTZ6GOwz/HAfwpcS/AAV/N5dGHzhyrPWuuljlMBmq+DT7/rn1pN96P8APB 6qQg== Original-Received: by 10.180.97.228 with SMTP id ed4mr25637771wib.0.1336233464897; Sat, 05 May 2012 08:57:44 -0700 (PDT) Original-Received: from thierry-MM061 (lbe83-2-78-243-104-167.fbx.proxad.net. [78.243.104.167]) by mx.google.com with ESMTPS id b3sm6711726wib.4.2012.05.05.08.57.42 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 05 May 2012 08:57:43 -0700 (PDT) In-Reply-To: (Stefan Monnier's message of "Sat, 05 May 2012 09:26:32 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.212.169 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:150291 Archived-At: Stefan Monnier 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. Thanks. -- Thierry Get my Gnupg key: gpg --keyserver pgp.mit.edu --recv-keys 59F29997