From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Richard Riley Newsgroups: gmane.emacs.help Subject: Re: Working with constansts Date: Sun, 10 May 2009 19:28:43 +0200 Organization: aich tea tea pea dicky riley dot net Message-ID: <4a070ecc.0c58560a.2fff.1683@mx.google.com> References: <87d4ahylp3.fsf@galatea.local> <000801c9d191$22a21340$0200a8c0@us.oracle.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1241976565 9438 80.91.229.12 (10 May 2009 17:29:25 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 10 May 2009 17:29:25 +0000 (UTC) Cc: help-gnu-emacs@gnu.org, 'Richard Riley' To: "Drew Adams" Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun May 10 19:29:15 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 1M3Cpt-0000eq-4Y for geh-help-gnu-emacs@m.gmane.org; Sun, 10 May 2009 19:29:13 +0200 Original-Received: from localhost ([127.0.0.1]:44200 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1M3Cps-0007QF-FS for geh-help-gnu-emacs@m.gmane.org; Sun, 10 May 2009 13:29:12 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1M3CpW-0007Px-O5 for help-gnu-emacs@gnu.org; Sun, 10 May 2009 13:28:50 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1M3CpV-0007Pl-BL for help-gnu-emacs@gnu.org; Sun, 10 May 2009 13:28:49 -0400 Original-Received: from [199.232.76.173] (port=60217 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1M3CpV-0007Pi-6r for help-gnu-emacs@gnu.org; Sun, 10 May 2009 13:28:49 -0400 Original-Received: from fg-out-1718.google.com ([72.14.220.157]:7253) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1M3CpS-0001Bm-D3 for help-gnu-emacs@gnu.org; Sun, 10 May 2009 13:28:49 -0400 Original-Received: by fg-out-1718.google.com with SMTP id e12so731530fga.7 for ; Sun, 10 May 2009 10:28:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:received:received:message-id:from:to:cc:subject :organization:references:date:in-reply-to:user-agent:mime-version :content-type; bh=P7cjJh2bX4dmddM5Vq/a2eUQUYOhU9+biANZmHGmRaw=; b=Ak9SxG2WHOQ8saugnnA+p8VDn/MqExPaX7QD0jIcyBEOKPd0mafyJU0GcZphYVlvUV Mk6vEARHmEAxreXzJcT58UDRvXFIEZH8WRZTzktw8IXW4HjdPdQsc00RdYXgsKSVPnac 0YHsC6lfEDTlaCsinnSxtmkts/MGHb58fAW2w= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=message-id:from:to:cc:subject:organization:references:date :in-reply-to:user-agent:mime-version:content-type; b=xUxUawjDk2V8IcNlgdyFElzshKVhowNnQ54+FuZw4pWnr74W2Qs3hw+Szl3vxkMkiJ YzGq4GnYmeF3XIMNRbNox5LyKhZMllmeDJHz5+6JJZFTIw3swohedoakOmrSTpoZmC/0 VtMUDM/RMC2HDSHPNAXFGzqiMW9EJRde8rtH4= Original-Received: by 10.86.98.10 with SMTP id v10mr5596100fgb.36.1241976525318; Sun, 10 May 2009 10:28:45 -0700 (PDT) Original-Received: from localhost ([85.183.18.158]) by mx.google.com with ESMTPS id l12sm1680299fgb.4.2009.05.10.10.28.44 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sun, 10 May 2009 10:28:44 -0700 (PDT) In-Reply-To: <000801c9d191$22a21340$0200a8c0@us.oracle.com> (Drew Adams's message of "Sun, 10 May 2009 10:02:42 -0700") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.92 (gnu/linux) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) 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:64323 Archived-At: "Drew Adams" writes: >> Why is it called a constant if its not enforced? > > As the doc says (explicitly): to signal programmer *intention*. It lets human > readers of the code know that it is *intended* that no one and no code will > change the value. Think of it as a comment to that effect, if you like: "Do not > change this value." > > Coding with clear signals of intention is helpful, and too often overlooked. > Conventional distinctions of intention among `defconst' vs `defvar'; `when' and > `unless' vs `if' and `cond' vs `and' and `or'; and so on can make a big > difference in code legibility. Which in turn eases maintenance and makes it less > error-prone. No two ways. I agree. > > Likewise, wrt names of functions, variables, etc.: good names help maintainers > and code borrowers. Likewise, comments - good ones. Likewise, indenting and > whitespace generally. > > All of these things are for human readers of code only. You, like the Lisp > reader, can do without them if you like. YMMV. I don't think anyone would disagree. But this is really a lecture on clear, structured programming for beginners and not really that relevant to the specifics of LISP constants in question. > > [I knew an excellent (in individual terms) Lisp programmer back in the 80s who > never used any whitespace that wasn't strictly needed for the Lisp reader and > never commented any code. He (almost) never hit the Return key. Needless to say, > no one else could work with his code. He did use reasonable names, however, and > he didn't use the same conditional (e.g. `if' or `cond') everywhere. He coded in > the way that was easiest to him and that got the point across to the Lisp > reader.] He sounds like a terrible programmer. Programmers that write for themselves are a curse. Maintenance time exceeds initial development time by factors of 10 or 100 in most cases. > > Perhaps you have another question: > Q. Why isn't it enforced? A. Lisp. > Not really. It's not a constant. Having the specific type and then being able to modify it proves that. You would be as well sticking CONST as the name prefix as far as the language goes. As clear. But yes, of course I agree with your comments on "intent". But it strikes me that its no more effective than, say requiring a file called "myconstants" that has a bunch of variables. So really the question would be : why does Lisp not enforce constants being, err, constant?