GNU bug report logs -
#58513
describe-function should say that defconst variables are constant
Previous Next
Full log
Message #44 received at 58513 <at> debbugs.gnu.org (full text, mbox):
> > And then, in a later Emacs version, we could start enforcing the
> > constness in running code.
>
> defconst has had a subtle meaning: "It is ok to expect, in certain
> limited ways, that the value will not be altered." Nothing more.
>
> This change may seem to be fixing a bug, but some old programs used to
> take advantage of the actual old meaning. This change might break
> them.
>
> I think that would be asking for trouble, and we have better things to
> do than deal with that trouble.
+1.
_____
FWIW, Common Lisp has `defconstant':
"Constant symbols defined by defconstant also become reserved
and may not be further assigned to or bound (although they
may be redefined, if necessary, by using defconstant again)."
https://www.cs.cmu.edu/Groups/AI/html/cltl/clm/node58.html#SECTION00912000000000000000
"...assert that the value of the variable name is fixed and
does license the compiler to build assumptions about the
value into programs being compiled. (However, if the compiler
chooses to replace references to the name of the constant by
the value of the constant in code to be compiled, perhaps in
order to allow further optimization, the compiler must take
care that such ``copies'' appear to be eql to the object that
is the actual value of the constant. For example, the compiler
may freely make copies of numbers but must exercise care when
the value is a list.)"
https://www.cs.cmu.edu/Groups/AI/html/cltl/clm/node67.html#SECTION00932000000000000000
This bug report was last modified 2 years and 242 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.