all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: "rms@gnu.org" <rms@gnu.org>, Lars Ingebrigtsen <larsi@gnus.org>
Cc: "psainty@orcon.net.nz" <psainty@orcon.net.nz>,
	"stefan@marxist.se" <stefan@marxist.se>,
	"monnier@iro.umontreal.ca" <monnier@iro.umontreal.ca>,
	"58513@debbugs.gnu.org" <58513@debbugs.gnu.org>
Subject: bug#58513: describe-function should say that defconst variables are constant
Date: Sun, 16 Oct 2022 21:11:01 +0000	[thread overview]
Message-ID: <SJ0PR10MB5488558A398AA44F301DB708F3269@SJ0PR10MB5488.namprd10.prod.outlook.com> (raw)
In-Reply-To: <E1okAc1-0002zQ-D6@fencepost.gnu.org>

>   > 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


  reply	other threads:[~2022-10-16 21:11 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-14 12:04 bug#58513: describe-function should say that defconst variables are constant Stefan Kangas
2022-10-14 12:23 ` Lars Ingebrigtsen
2022-10-14 12:35   ` Phil Sainty
2022-10-14 12:40     ` Lars Ingebrigtsen
2022-10-14 13:03       ` Stefan Kangas
2022-10-14 13:07         ` Lars Ingebrigtsen
2022-10-14 13:34           ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-10-14 14:25             ` Lars Ingebrigtsen
2022-10-14 16:44               ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-10-15 10:04                 ` Lars Ingebrigtsen
2022-10-16 20:51                   ` Richard Stallman
2022-10-16 21:11                     ` Drew Adams [this message]
2022-10-17  5:41                     ` Stefan Kangas
2022-10-17 10:41                       ` Lars Ingebrigtsen
2022-10-15 12:33             ` Stefan Kangas
2022-10-15 14:11               ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=SJ0PR10MB5488558A398AA44F301DB708F3269@SJ0PR10MB5488.namprd10.prod.outlook.com \
    --to=drew.adams@oracle.com \
    --cc=58513@debbugs.gnu.org \
    --cc=larsi@gnus.org \
    --cc=monnier@iro.umontreal.ca \
    --cc=psainty@orcon.net.nz \
    --cc=rms@gnu.org \
    --cc=stefan@marxist.se \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.