Subject: defvaralias after defvar should be warned in runtime

From: IRIE Shinsuke <[email-masked]>
Date: Thu, 15 Apr 2010 14:13:58 +0900

Please consider below:

We assume an user wrote .emacs file as:

 (setq old-foo 123)
 (load "bar")

Here, bar.el includes the following:

 (defvar foo 456)
 (define-obsolete-variable-alias 'old-foo 'foo)

By this .emacs setting, the user probably hopes `old-foo' remains 123
after loading bar.el, but actually it will be changed to 456. This
behavior is inconsistent with the principle that `defvar' must not
override existing value, so bar.el should be modified as:

 (define-obsolete-variable-alias 'old-foo 'foo)
 (defvar foo 456)

I think the programs like bar.el should be warned when running (and
byte-compiling, if possible).

-- 
IRIE Shinsuke, Ph.D.