Subject: Re: bug#58513: describe-function should say that defconst variables are constant

From: Lars Ingebrigtsen <[email-masked]>
Date: Sat, 15 Oct 2022 12:04:17 +0200

Stefan Monnier <[email-masked]> writes:

> - since that new branch always signals an error (well, in my own code,
>   that is: I don't know what that branch would end up doing on `master`
>   where we'd want to be more careful about backward compatibility), it's
>   expected to be more-or-less never taken and even the most naive branch
>   predictors should handle it "perfectly".

I see; that sounds good.

So perhaps we should be moving in this direction, then.

That is, start by making defconst mark the variables (perhaps in the way
you've already implemented?), and then make byte-compilation warn about
assigning to defconsts (and make describe-function expose the
information, as requested).

And then, in a later Emacs version, we could start enforcing the
constness in running code.