[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Warnings about keymaps

From: Stefan Monnier
Subject: Re: Warnings about keymaps
Date: Mon, 14 Sep 2009 17:46:25 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux)

>> 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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]