From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Drew Adams Newsgroups: gmane.emacs.help Subject: RE: DynamicBindingVsLexicalBinding Date: Mon, 14 Oct 2013 06:45:44 -0700 (PDT) Message-ID: <20367a8e-c17c-4a10-8934-b5a24f2cddf0@default> References: <52598D4A.2010901@easy-emacs.de> <871u3qjq0j.fsf@yandex.ru> <525A51BD.5040903@easy-emacs.de> <525AA42B.6030006@gmx.net> <6d5df021-be1e-40a2-966a-548a7ee9deb3@default> <87txgk85em.fsf@zerg32.ncl.ac.uk> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1381758369 9072 80.91.229.3 (14 Oct 2013 13:46:09 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 14 Oct 2013 13:46:09 +0000 (UTC) Cc: help-gnu-emacs@gnu.org, =?iso-8859-1?B?S2FpIEdyb99qb2hhbm4=?= To: phillip.lord@newcastle.ac.uk Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Oct 14 15:46:12 2013 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1VViTM-00026I-HI for geh-help-gnu-emacs@m.gmane.org; Mon, 14 Oct 2013 15:46:12 +0200 Original-Received: from localhost ([::1]:36914 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VViTM-0002M7-6t for geh-help-gnu-emacs@m.gmane.org; Mon, 14 Oct 2013 09:46:12 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:54365) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VViT5-0002Kj-VI for help-gnu-emacs@gnu.org; Mon, 14 Oct 2013 09:46:03 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VViSy-0005bA-RN for help-gnu-emacs@gnu.org; Mon, 14 Oct 2013 09:45:55 -0400 Original-Received: from aserp1040.oracle.com ([141.146.126.69]:51835) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VViSy-0005a6-Jn for help-gnu-emacs@gnu.org; Mon, 14 Oct 2013 09:45:48 -0400 Original-Received: from ucsinet22.oracle.com (ucsinet22.oracle.com [156.151.31.94]) by aserp1040.oracle.com (Sentrion-MTA-4.3.1/Sentrion-MTA-4.3.1) with ESMTP id r9EDjilI014292 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 14 Oct 2013 13:45:45 GMT Original-Received: from userz7022.oracle.com (userz7022.oracle.com [156.151.31.86]) by ucsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id r9EDjhqb005363 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 14 Oct 2013 13:45:43 GMT Original-Received: from abhmt101.oracle.com (abhmt101.oracle.com [141.146.116.53]) by userz7022.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id r9EDjhQQ005353; Mon, 14 Oct 2013 13:45:43 GMT In-Reply-To: <87txgk85em.fsf@zerg32.ncl.ac.uk> X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.8 (707110) [OL 12.0.6680.5000 (x86)] X-Source-IP: ucsinet22.oracle.com [156.151.31.94] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 141.146.126.69 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:94011 Archived-At: > > Yes. Which is especially important for a heavily interactive and > > customizable program such as Emacs. Emacs users extend and > > otherwise modify or adapt the source code, and they do so sometimes > > on the fly and interactively. >=20 > I don't think this is an advantage of dynamic binding; it's just an > advantage of having lots of configuration options. Which are dynamically bound variables. Perhaps you are not as lexical as you think. ;-) Do you mean that you are OK with assigning values to such global, dynamically bound variables at startup time, and you are OK with a user changing their values interactively anytime (e.g. using Customize), but you are not OK with code let-binding global, dynamically bound variables? Assignment is OK by you, but not let-binding? > I've certainly used the feature that Kai likes, but mostly it has > been to hack around code which I do not control or do not want to > change. Nowadays, in general, I would want to advice code instead. http://www.gnu.org/software/emacs/emacs-paper.html#SEC17 (Richard Stallman, 1981), including: "Formal Parameters Cannot Replace Dynamic Scope Some language designers believe that dynamic binding should be avoided, and explicit argument passing should be used instead. Imagine that function A binds the variable FOO, and calls the function B, which calls the function C, and C uses the value of FOO. Supposedly A should pass the value as an argument to B, which should pass it as an argument to C.=20 This cannot be done in an extensible system, however, because the author of the system cannot know what all the parameters will be. Imagine that the functions A and C are part of a user extension, while B is part of the standard system. The variable FOO does not exist in the standard system; it is part of the extension. To use explicit argument passing would require adding a new argument to B, which means rewriting B and everything that calls B. In the most common case, B is the editor command dispatcher loop, which is called from an awful number of places.= =20 What's worse, C must also be passed an additional argument. B doesn't refer to C by name (C did not exist when B was written). It probably finds a pointer to C in the command dispatch table. This means that the same call which sometimes calls C might equally well call any editor command definition. So all the editing commands must be rewritten to accept and ignore the additional argument. By now, none of the original system is left!"