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

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

bug#58513: describe-function should say that defconst variables are cons


From: Stefan Kangas
Subject: bug#58513: describe-function should say that defconst variables are constant
Date: Mon, 17 Oct 2022 05:41:09 +0000

Richard Stallman <rms@gnu.org> writes:

> defconst has had a subtle meaning: "It is ok to expect, in certain
> limited ways, that the value will not be altered."  Nothing more.

To my mind, the meaning is not subtle.  On the contrary, it is both
clear and well-documented.

The manual (info "(elisp) Defining Variables") explains:

    [defconst] defines SYMBOL as a value and initializes it.  It informs
    a person reading your code that SYMBOL has a standard global value,
    established here, that should not be changed by the user or by other
    programs.

>From where I'm standing, this means that there is no practical
difference between a defconst and a defvar that Lisp code can rely on.

So, to give a somewhat contrived example, you can still break any
mathematical calculation in Emacs with:

    (setq float-pi 9)

The only way to not have your code break in the face of that is to
copy-paste the literal 3.141592... everywhere.





reply via email to

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