From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: Why is Elisp's defvar weird? And is eval_sub broken? Date: Sat, 14 Feb 2015 09:36:16 -0500 Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1423924601 22038 80.91.229.3 (14 Feb 2015 14:36:41 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 14 Feb 2015 14:36:41 +0000 (UTC) Cc: emacs-devel@gnu.org To: Kelly Dean Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Feb 14 15:36:32 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 1YMdpe-0005Ja-RU for ged-emacs-devel@m.gmane.org; Sat, 14 Feb 2015 15:36:30 +0100 Original-Received: from localhost ([::1]:60054 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YMdpe-000622-BT for ged-emacs-devel@m.gmane.org; Sat, 14 Feb 2015 09:36:30 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:42938) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YMdpa-00061v-G0 for emacs-devel@gnu.org; Sat, 14 Feb 2015 09:36:27 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YMdpX-0001XW-9Y for emacs-devel@gnu.org; Sat, 14 Feb 2015 09:36:26 -0500 Original-Received: from pruche.dit.umontreal.ca ([132.204.246.22]:49165) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YMdpX-0001XK-4U for emacs-devel@gnu.org; Sat, 14 Feb 2015 09:36:23 -0500 Original-Received: from pastel.home (lechon.iro.umontreal.ca [132.204.27.242]) by pruche.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id t1EEaLQ4015809; Sat, 14 Feb 2015 09:36:22 -0500 Original-Received: by pastel.home (Postfix, from userid 20848) id 29EAECC3; Sat, 14 Feb 2015 09:36:16 -0500 (EST) In-Reply-To: (Kelly Dean's message of "Sat, 14 Feb 2015 07:35:58 +0000") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) X-NAI-Spam-Flag: NO X-NAI-Spam-Threshold: 5 X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 1 Rules triggered RV5217=0 X-NAI-Spam-Version: 2.3.0.9393 : core <5217> : inlines <2181> : streams <1390139> : uri <1855180> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 132.204.246.22 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:183055 Archived-At: > A declaration of free dynamic variables for a function could tell the > byte compiler that those free variables aren't typos, since > otherwise the byte compiler would expect either the symbol to be > declared special or a lexical variable by that name to be in scope. There is such a declaration already. It's called (defvar ). Tada! >> Normally, such conflicts should never happen >> because all special vars should be named with a "package prefix", but >> sadly, reality is different, so it was indispensable to make this >> effect local, to allow lexical-binding code to work reliably. > By using llet, the byte compiler will catch such conflicts, and your code > (interpreted or compiled) that uses it will work reliably despite the > conflicts. This means defvar's weird behavior is no longer needed. It's not weird once you understand that it's a compiler directive which is absent from the .elc file. Stefan