From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tassilo Horn Newsgroups: gmane.emacs.help Subject: Re: Working with constansts Date: Mon, 11 May 2009 09:39:49 +0200 Message-ID: <87zldkdr5m.fsf@thinkpad.tsdh.de> References: <87d4ahylp3.fsf@galatea.local> <000801c9d191$22a21340$0200a8c0@us.oracle.com> <4a070ecc.0c58560a.2fff.1683@mx.google.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1242027689 23946 80.91.229.12 (11 May 2009 07:41:29 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 11 May 2009 07:41:29 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon May 11 09:41:21 2009 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1M3Q8W-0001wJ-Vj for geh-help-gnu-emacs@m.gmane.org; Mon, 11 May 2009 09:41:21 +0200 Original-Received: from localhost ([127.0.0.1]:50167 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1M3Q8W-0000Jc-GV for geh-help-gnu-emacs@m.gmane.org; Mon, 11 May 2009 03:41:20 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1M3Q7T-0008RR-Gd for help-gnu-emacs@gnu.org; Mon, 11 May 2009 03:40:15 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1M3Q7N-0008Q6-DO for help-gnu-emacs@gnu.org; Mon, 11 May 2009 03:40:14 -0400 Original-Received: from [199.232.76.173] (port=53291 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1M3Q7M-0008Pz-VG for help-gnu-emacs@gnu.org; Mon, 11 May 2009 03:40:08 -0400 Original-Received: from mx20.gnu.org ([199.232.41.8]:27080) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1M3Q7M-0002Wq-1y for help-gnu-emacs@gnu.org; Mon, 11 May 2009 03:40:08 -0400 Original-Received: from main.gmane.org ([80.91.229.2] helo=ciao.gmane.org) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1M3Q7J-0002t2-SC for help-gnu-emacs@gnu.org; Mon, 11 May 2009 03:40:06 -0400 Original-Received: from list by ciao.gmane.org with local (Exim 4.43) id 1M3Q7G-0007Xu-Nu for help-gnu-emacs@gnu.org; Mon, 11 May 2009 07:40:02 +0000 Original-Received: from dhcp71.uni-koblenz.de ([141.26.71.71]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 11 May 2009 07:40:02 +0000 Original-Received: from tassilo by dhcp71.uni-koblenz.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 11 May 2009 07:40:02 +0000 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 33 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: dhcp71.uni-koblenz.de User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.93 (gnu/linux) Cancel-Lock: sha1:rCJeHZlTSsS5FOuXO+Sxj1Te/uM= X-Detected-Operating-System: by mx20.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:64342 Archived-At: Richard Riley writes: Hi Richard, > So really the question would be : why does Lisp not enforce constants > being, err, constant? I think it has something to do how lisp programs can be maintained. What looks like a constant today may change in the future (maybe by something totally unrelated like a new law). With java for example, you would change that constant in the code, rebuild and restart the application. With lisp you go to the repl and simply change the constant without having to restart anything. So you see that enforcing immutability of constants has drawbacks, too. But the emacs byte-compiler issues a warning instead: ,----[ ~/test.el ] | (defconst test-constant "CONSTANT") | (setq test-constant "CHANGED") `---- --8<---------------cut here---------------start------------->8--- % emacs -Q --batch -f batch-byte-compile test.el In toplevel form: test.el:3:7:Warning: variable assignment to constant `test-constant' Wrote /home/horn/test.elc --8<---------------cut here---------------end--------------->8--- Bye, Tassilo -- Chuck Norris once rode a bull, and nine months later it had a calf.