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: lexical-binding questions Date: Tue, 15 May 2012 22:05:36 -0400 Message-ID: References: <871umzrvfw.fsf@gmail.com> <33827449.post@talk.nabble.com> <87vcjylmfl.fsf@gnu.org> <33849639.post@talk.nabble.com> <87d3656og5.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1337133950 1107 80.91.229.3 (16 May 2012 02:05:50 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 16 May 2012 02:05:50 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed May 16 04:05:48 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 1SUTcW-00059U-N2 for ged-emacs-devel@m.gmane.org; Wed, 16 May 2012 04:05:44 +0200 Original-Received: from localhost ([::1]:59005 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SUTcV-0000Wc-PQ for ged-emacs-devel@m.gmane.org; Tue, 15 May 2012 22:05:43 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:56964) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SUTcS-0000WV-U1 for emacs-devel@gnu.org; Tue, 15 May 2012 22:05:42 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SUTcR-0000i4-8q for emacs-devel@gnu.org; Tue, 15 May 2012 22:05:40 -0400 Original-Received: from ironport-out.teksavvy.com ([206.248.143.162]:6724) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SUTcR-0000hu-3s for emacs-devel@gnu.org; Tue, 15 May 2012 22:05:39 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApUIACxOgk9FpZcD/2dsb2JhbABDuCMDgQyBCIIJAQEEAScvKAsLNBIUGA2IQAW2MothgVWDJASkRYFdgwM X-IronPort-AV: E=Sophos;i="4.75,391,1330923600"; d="scan'208";a="180453996" Original-Received: from 69-165-151-3.dsl.teksavvy.com (HELO ceviche.home) ([69.165.151.3]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 15 May 2012 22:05:36 -0400 Original-Received: by ceviche.home (Postfix, from userid 20848) id 6A810660EE; Tue, 15 May 2012 22:05:36 -0400 (EDT) In-Reply-To: <87d3656og5.fsf@gnu.org> ("Johan =?iso-8859-1?Q?Bockg=E5rd=22?= =?iso-8859-1?Q?'s?= message of "Wed, 16 May 2012 00:59:06 +0200") 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: 206.248.143.162 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:150510 Archived-At: >>>> (setq lexical-binding t) >>>> (let ((nil 0)) nil) => 0 >> Anyway, I guess nil and t should be marked as special-variable-p, if for >> no other reason than because they are pretty damn special. > The problem also applies to keyword symbols. Indeed, except it's a lot less likely that people will try to let-bind a keyword symbol (it happens to me several times a year to choose `t' for a variable name, only to find it doesn't work, but I never suffered from that problem with a keyword symbol). > I was thinking > if (!NILP (lexenv) && SYMBOLP (var) > + && !SYMBOL_CONSTANT_P (var) > && !XSYMBOL (var)->declared_special > && NILP (Fmemq (var, Vinternal_interpreter_environment))) > /* Lexically bind VAR by adding it to the lexenv alist. */ > lexenv = Fcons (Fcons (var, tem), lexenv); It would be more efficient to set declared_special on keyword symbols. Stefan