From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Jisang Yoo Newsgroups: gmane.emacs.bugs Subject: bug#14772: 24.3; defvar and lexical-binding in interpreted elisp code Date: Wed, 3 Jul 2013 05:52:02 +0900 Message-ID: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: ger.gmane.org 1372799355 21837 80.91.229.3 (2 Jul 2013 21:09:15 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 2 Jul 2013 21:09:15 +0000 (UTC) To: 14772@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Jul 02 23:09:13 2013 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1Uu7p3-000297-42 for geb-bug-gnu-emacs@m.gmane.org; Tue, 02 Jul 2013 23:09:13 +0200 Original-Received: from localhost ([::1]:45163 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uu7p2-0006so-B7 for geb-bug-gnu-emacs@m.gmane.org; Tue, 02 Jul 2013 17:09:12 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:50124) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uu7ow-0006sV-C4 for bug-gnu-emacs@gnu.org; Tue, 02 Jul 2013 17:09:09 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Uu7ot-0004Bb-Ip for bug-gnu-emacs@gnu.org; Tue, 02 Jul 2013 17:09:06 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:58658) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uu7ot-0004BR-FX for bug-gnu-emacs@gnu.org; Tue, 02 Jul 2013 17:09:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1Uu7os-0006Gk-OP for bug-gnu-emacs@gnu.org; Tue, 02 Jul 2013 17:09:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Jisang Yoo Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 02 Jul 2013 21:09:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 14772 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.137279931324048 (code B ref -1); Tue, 02 Jul 2013 21:09:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 2 Jul 2013 21:08:33 +0000 Original-Received: from localhost ([127.0.0.1]:52974 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Uu7oO-0006Fn-4i for submit@debbugs.gnu.org; Tue, 02 Jul 2013 17:08:32 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:44321) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Uu7Yo-0005po-Sc for submit@debbugs.gnu.org; Tue, 02 Jul 2013 16:52:27 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Uu7Ye-00079h-Lr for submit@debbugs.gnu.org; Tue, 02 Jul 2013 16:52:21 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:39708) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uu7Ye-00079U-IG for submit@debbugs.gnu.org; Tue, 02 Jul 2013 16:52:16 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:45992) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uu7YZ-00035b-Jk for bug-gnu-emacs@gnu.org; Tue, 02 Jul 2013 16:52:16 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Uu7YR-0006x0-7y for bug-gnu-emacs@gnu.org; Tue, 02 Jul 2013 16:52:11 -0400 Original-Received: from mail-qa0-x22b.google.com ([2607:f8b0:400d:c00::22b]:43402) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uu7YR-0006wt-4I for bug-gnu-emacs@gnu.org; Tue, 02 Jul 2013 16:52:03 -0400 Original-Received: by mail-qa0-f43.google.com with SMTP id d13so3162091qak.16 for ; Tue, 02 Jul 2013 13:52:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:date:x-google-sender-auth:message-id:subject :from:to:content-type; bh=HOU+xRmMy/0vZ48m1sM9iO3WiaOXbu0OhO8yAIU7a1E=; b=i5P3pMNTb8/8R3x2cDA1wfvmxf0evSy6Vw0RgSmCpcX67YCNEk53zdz8jhwucAWLI4 CTul/EtR5XJFn7ROIYfbaT/kTx1awErZPMbw5SEecuym4MC7mo+ILMagUNx9ybTw555g WngcKvO8V2Yk79DGtNJqGYexCLTijeTZ5Lc8jJV6BfhJknGs0a4URBIWINCAjB9JsvlQ GB699YOU3DMSHjNf6dK1ANJUwpIwPx4YDu9HMjWM5I/lYpm15r7ER9gf/HaaxJ9E2K9Z WbWNySpMJJbtnjZqZ8B6b1uZBx3yObntbZR64ai7TxbZDRXwyOHYe8r9lFNygBAHF6IL MORA== X-Received: by 10.49.35.180 with SMTP id i20mr40722677qej.61.1372798322562; Tue, 02 Jul 2013 13:52:02 -0700 (PDT) Original-Received: by 10.224.121.4 with HTTP; Tue, 2 Jul 2013 13:52:02 -0700 (PDT) X-Google-Sender-Auth: I0PYtDedAG-RJ_oQatJZNBfBYrQ X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Mailman-Approved-At: Tue, 02 Jul 2013 17:08:30 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:75819 Archived-At: Short description: Declaring a special variable affects lexical local variables of the same name (in interpreted code) in a half measure way, thereby deviating from both the newbies expectation and the common lisp expectation. Long description: contents of alice.el: ;; -*- lexical-binding: t; -*- ;; two functions that are supposed to do the same thing (defun alice-multiplier-1 (foo) (lambda (n) (* n foo))) (defun alice-multiplier-2 (num) (let ((foo num)) (lambda (n) (* n foo)))) ;; breaking bad (defvar foo 1000) ;; time to see its effects (print (list :R3 (mapcar (alice-multiplier-1 10) (list 1 2 3)) :R4 (mapcar (alice-multiplier-2 10) (list 1 2 3)))) Output from emacs -q --load alice.el: (:R3 (10 20 30) :R4 (1000 2000 3000)) What I expected: Either (:R3 (10 20 30) :R4 (10 20 30)) or (:R3 (1000 2000 3000) :R4 (1000 2000 3000)) One answer in http://stackoverflow.com/questions/17400556/strange-interaction-between-lexical-binding-and-defvar-in-emacs-lisp suggests that (:R3 (1000 2000 3000) :R4 (1000 2000 3000)) should be the right output, which is the same as the CLIST output according to my test.