Subject: Re: bug#5950: defvaralias after defvar should be warned in runtime

From: Stefan Monnier <[email-masked]>
Date: Thu, 16 Sep 2010 11:27:57 +0200

>> I think the byte-hunk-handler should be put to `defvaralias' rather than
>> `define-obsolete-variable-alias'. `defvaralias' is a primitive function
>> which causes the problem in `define-obsolete-variable-alias' macro.
> The issue _is_ with defvaralias, but it's only a problem for user
> options, things that might be set in .emacs before the associated
> alias definition is evaluated.  It's hard to see why there should be
> non-obsolete aliases to user options, it just causes confusion.  I
> think there would be false positives if the warning was associated
> with defvaralias, which is mostly used with non-user-options, I would
> think.

> The last time a similar issue came up, Stefan preferred that only
> define-obsolete-variable-alias be changed; see

Well, in this case I'd rather check defvaralias, since the problem is
there: if (defvaralias 'foo 'bar) is executed after both `foo' and `bar'
have been given values, then it will necessarily have to drop one of the
two, which is the source of the problem.

Changing defvaralias to try and be more clever would definitely
be wrong.  But changing it to output a warning about the problematic
situation would be OK and changing the byte-compiler to output a warning
in cases that make such a situation more likely is also perfectly good.

        Stefan