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: Warnings about keymaps Date: Mon, 14 Sep 2009 17:46:25 -0400 Message-ID: References: <83ocph26p7.fsf@gnu.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1252964814 15210 80.91.229.12 (14 Sep 2009 21:46:54 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 14 Sep 2009 21:46:54 +0000 (UTC) Cc: Eli Zaretskii , emacs-devel@gnu.org To: Glenn Morris Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Sep 14 23:46:47 2009 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1MnJNh-0002YX-KA for ged-emacs-devel@m.gmane.org; Mon, 14 Sep 2009 23:46:41 +0200 Original-Received: from localhost ([127.0.0.1]:39602 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MnJNh-0006QR-04 for ged-emacs-devel@m.gmane.org; Mon, 14 Sep 2009 17:46:41 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MnJNb-0006KX-4O for emacs-devel@gnu.org; Mon, 14 Sep 2009 17:46:35 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MnJNW-000684-LM for emacs-devel@gnu.org; Mon, 14 Sep 2009 17:46:34 -0400 Original-Received: from [199.232.76.173] (port=57199 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MnJNW-00067n-Co for emacs-devel@gnu.org; Mon, 14 Sep 2009 17:46:30 -0400 Original-Received: from pruche.dit.umontreal.ca ([132.204.246.22]:56522) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MnJNT-0006UX-Kz; Mon, 14 Sep 2009 17:46:27 -0400 Original-Received: from faina.iro.umontreal.ca (faina.iro.umontreal.ca [132.204.26.177]) by pruche.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id n8ELkP6D016527; Mon, 14 Sep 2009 17:46:26 -0400 Original-Received: by faina.iro.umontreal.ca (Postfix, from userid 20848) id E0D8C3A28A; Mon, 14 Sep 2009 17:46:25 -0400 (EDT) In-Reply-To: (Glenn Morris's message of "Mon, 14 Sep 2009 15:10:25 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux) X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 1 Rules triggered RV3362=0 X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:115320 Archived-At: >> The bug can be seen more directly by byte-compiling the file below: >> >> (defconst foo nil) >> (defvar foo nil) >> >> Looks like the "assignment-to-constant" warning should be more >> careful to distinguish defvar from setq. > This seems a fairly nonsensical thing to do, so why shouldn't the > compiler warn about it? It could, but it shouldn't complain about assignment to a constant, since the defvar will not perform any assignment. I.e. maybe a warning is OK, but not the warning we currently get. > The defvar is a best a no-op, at worst a bug > (if you were expecting it to have an effect). In the OP's case the defvar was expected to have as effect to "provide a default value to the var in case it's not defined elsewhere". So it seems to behave as expected (it's a no-op since the var is defined elsewhere). Stefan