From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: Real constants Date: Wed, 13 Jul 2005 14:14:45 -0400 Message-ID: <87u0iymvce.fsf-monnier+emacs@gnu.org> References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1121280397 24920 80.91.229.2 (13 Jul 2005 18:46:37 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 13 Jul 2005 18:46:37 +0000 (UTC) Cc: Emacs Devel Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Jul 13 20:46:36 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1DsmFI-0006xj-FI for ged-emacs-devel@m.gmane.org; Wed, 13 Jul 2005 20:46:12 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DsmGz-0005He-8X for ged-emacs-devel@m.gmane.org; Wed, 13 Jul 2005 14:47:57 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1DsmDZ-0002HP-Qz for emacs-devel@gnu.org; Wed, 13 Jul 2005 14:44:25 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1DsmDW-0002GR-P0 for emacs-devel@gnu.org; Wed, 13 Jul 2005 14:44:24 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DsmBq-00018x-Gn for emacs-devel@gnu.org; Wed, 13 Jul 2005 14:42:40 -0400 Original-Received: from [209.226.175.97] (helo=tomts40-srv.bellnexxia.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1Dslsk-0001NO-BE for emacs-devel@gnu.org; Wed, 13 Jul 2005 14:22:54 -0400 Original-Received: from alfajor ([67.71.25.244]) by tomts40-srv.bellnexxia.net (InterMail vM.5.01.06.10 201-253-122-130-110-20040306) with ESMTP id <20050713181445.JFDX1799.tomts40-srv.bellnexxia.net@alfajor>; Wed, 13 Jul 2005 14:14:45 -0400 Original-Received: by alfajor (Postfix, from userid 1000) id CB29ED7571; Wed, 13 Jul 2005 14:14:45 -0400 (EDT) Original-To: Juanma Barranquero In-Reply-To: (Juanma Barranquero's message of "Wed, 13 Jul 2005 15:59:13 +0200") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:40872 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:40872 > This is *not* a proposed change for 22.1; more of a question about a > feature, or lack of it. > Having the possibility of marking a symbol as constant (not in the > `defconst' sense, but really constant) seems so potentially useful and > so trivial to implement (vide the attached patch), that I can only > suppose there's some reason, or perceived problem, not to have done it > till now. > Could someone please explain the rationale for not having true > constants in elisp? I believe it's mostly because it wasn't nearly as trivial/cheap until Gerd installed his defvaralias patch, which also introduced the `constant' field in symbols. Among the local patches I use, I've expanded this `constant' field to 2 bits, so it can be either hard-read-only or soft-read-only (or writable, of course). The soft-read-only state is used by defconst so that variables defined by defconst cannot be setq but can be changed via defconst (important when you reload a new version of a package where a defconst was changed). Making defconst variables into constants introduces a few occasional problems with some packages, of course, but nothing too hard to fix. Stefan