help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: defvar vs defconst


From: Emanuel Berg
Subject: Re: defvar vs defconst
Date: Fri, 02 Aug 2013 23:05:02 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.4 (gnu/linux)

Thorsten Jolitz <tjolitz@gmail.com> writes:

> (defconst ...) signals "don't touch this", which seems to the
> right thing in this case, but OTOH it is a bit strange to call
> something a constant that not only can be changed, but will
> actually be changed quite often.

A constant should not be changed, not by a human, and not by a
computer, either. This is my firm intuition.

#00FF00 for green and #FFFF00 for yellow; 3.1415... for PI;
etc. This is the stuff you always make constants of.

number_of_attempts *could* be a constant, because once set, it
would never be changed in an execution run, and actually not at
all, unless there is a policy decision to change the number of
attempts. Still, I'd prefer it a variable.

In your particular case, I don't know. Are there different
implications using the methods, if you don't consider what signals
they send to a human user?

-- 
Emanuel Berg - programmer (hire me! CV below)
computer projects: http://user.it.uu.se/~embe8573
internet activity: http://home.student.uu.se/embe8573


reply via email to

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