From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ralf Wachinger Newsgroups: gmane.emacs.help Subject: Re: Working with constansts Date: 13 May 2009 13:41:27 GMT Organization: Ratiocinator Maximus Message-ID: <20090513.geh.3ab9xhlg.2@wachinger.fqdn.th-h.de> 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 1242225653 22659 80.91.229.12 (13 May 2009 14:40:53 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 13 May 2009 14:40:53 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed May 13 16:40:43 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 1M4FdR-0006xL-Ky for geh-help-gnu-emacs@m.gmane.org; Wed, 13 May 2009 16:40:41 +0200 Original-Received: from localhost ([127.0.0.1]:43881 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1M4FdR-0002rM-3d for geh-help-gnu-emacs@m.gmane.org; Wed, 13 May 2009 10:40:41 -0400 Original-Path: news.stanford.edu!newsfeed.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!kanaga.switch.ch!switch.ch!news.belwue.de!newsfeed.arcor.de!newsspool2.arcor-online.net!news.arcor.de.POSTED!not-for-mail Original-Newsgroups: gnu.emacs.help User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.93 (windows-nt) Cancel-Lock: sha1:l5+G+PX6POYIqHyYGQj0Ua37r9Q= Original-Lines: 38 Original-NNTP-Posting-Date: 13 May 2009 15:41:27 CEST Original-NNTP-Posting-Host: 834a6187.newsspool1.arcor-online.net Original-X-Trace: DXC=7>`f35\VC@`>jlK2>IgHGdic==]BZ:afn4Fo<]lROoRa^YC2XCjHcbidaN<>KX1YlnI>?9i<6DD5joF1DI6aLcng^cDPF8m:gje8P@8N^R\BFc Original-X-Complaints-To: usenet-abuse@arcor.de Original-Xref: news.stanford.edu gnu.emacs.help:169130 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:64393 Archived-At: * Barry Margolin wrote: > In article , > Nikolaj Schumacher wrote: > >> Richard Riley wrote: > >>> I don't know enough about Lisp than I can only assume that in this case >>> it can not be detected at compile time IF you compile to byte/p code. >> >> "Thanks" to dynamic scoping it cannot be caught at compile time. > > It could at least generate a warning. > >> (defconst xxx nil) >> >> (defun change-xxx () >> (setx xxx t)) ;; const or variable? >> >> (let ((xxx nil)) >> (change-xxx)) > > This should also warn about binding a constant. This recalls the discussions on constants (general), getters and setters (OOP) in Python to my mind. Functions as wrappers to enforce the intentions of the programmers. There are no constants (and even no declarations) in Python, there's only the convention to write intended constants in capitals. For class and instance attributes there are no private, protected or public declarations (you can even add attributes from outside later) in Python, there's only a convention to start the intended non-public attributes with an underline character. "The pythonic way" informs the users about the intentions, it doesn't restrict the users. I see that Python and Elisp have a pretty similar concept on the whole, both are very dynamic and unrestricted.