From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.help Subject: Re: Is add-to-list supposed to work when lexical-binding is t? Date: Thu, 13 Jun 2013 10:57:46 -0400 Organization: A noiseless patient Spider Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1371138709 30429 80.91.229.3 (13 Jun 2013 15:51:49 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 13 Jun 2013 15:51:49 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Jun 13 17:51:49 2013 Return-path: Envelope-to: geh-help-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 1Un9oP-0000NE-OQ for geh-help-gnu-emacs@m.gmane.org; Thu, 13 Jun 2013 17:51:45 +0200 Original-Received: from localhost ([::1]:50767 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Un9oP-0002Ab-Dg for geh-help-gnu-emacs@m.gmane.org; Thu, 13 Jun 2013 11:51:45 -0400 Original-Path: usenet.stanford.edu!news.kjsl.com!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!mx05.eternal-september.org!.POSTED!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 30 Injection-Info: mx05.eternal-september.org; posting-host="159116255ce7d0b522977afcd6e918a8"; logging-data="28703"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18C3ltAswrpjQgrHECYTbep" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) Cancel-Lock: sha1:ToJIvv5w9gKD8iQQ4zW8P2XpIk0= sha1:94iGyjQKmZzJAVinZDnd+V7vh8s= Original-Xref: usenet.stanford.edu gnu.emacs.help:199248 X-Mailman-Approved-At: Thu, 13 Jun 2013 11:49:51 -0400 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:91515 Archived-At: >>> I don't see cases where quote-var would fail to do what's intended. >> We can have gv-ref/quote-var/quote-lex/younameit, but what we can't do >> is merge it with quote, because their semantics are incompatible: >> (eq (let ((x 1)) (quote-var x)) (let ((x 1)) (quote-var x))) >> should return nil, whereas >> (eq (let ((x 1)) (quote x)) (let ((x 1)) (quote x))) >> should return t. > True, and that's a good way to explain the difference between a variable > and a symbol. And more importantly, it explains why we can't just blindly replace 'x with (quote-lex x). So there's no way to automatically and reliably make things like add-to-list/set/run-hooks/symbol-value/... work. BTW, I started to use a local hack which compiles all files in lexical-binding mode (hence bumping into all those problems). Some problematic cases are even more impossible for the compiler to auto-handle (see for example in auth-source.el): (let* ((base-required '(host user port secret)) [...] (dolist (br base-required) (when (symbol-value br) So now you'd need a quote-lex which doesn't work only to quote symbols but even lists of symbols (and I wouldn't be surprised to find places where a vector is used instead, or where the list is itselfs generated). Stefan