[Top][All Lists]

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

Re: defconst in lao.el

From: Stefan Monnier
Subject: Re: defconst in lao.el
Date: Wed, 17 Nov 2004 09:17:49 -0500
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/21.3.50 (gnu/linux)

> I used "defconst" for them because they have to be set back
> to nil when lao.el is re-loaded.  They are setup in the
> following (let ...) form to correct values.  If we change
> them to "defvar", they are anyway set to nil in that (let
> ...) form.  And, conceptually, they are "constant".  So I
> think "defconst" is better.

> Then, how to avoid the compiler warnings?  The problem is
> that their initial values are calculated at the same time
> (not one by one) in the "let" form.

The "right" answer is to put the defconst in the body of the let.
Of course if you do that, you get complaints from the byte-compiler because
it doesn't see those defconst as being at the top-level and thus doesn't
relize that they are *always* defined.

We should fix this in the byte-compiler but nobody's done it yet.
But you can work around those warnings by adding a couple (defvar foo)
before the let.  Ugly, tho.


reply via email to

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