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: Sun, 13 Oct 2013 09:21:33 -0700 (PDT) Message-ID: <6d5df021-be1e-40a2-966a-548a7ee9deb3@default> References: <52598D4A.2010901@easy-emacs.de> <871u3qjq0j.fsf@yandex.ru> <525A51BD.5040903@easy-emacs.de> <525AA42B.6030006@gmx.net> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1381681325 1203 80.91.229.3 (13 Oct 2013 16:22:05 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 13 Oct 2013 16:22:05 +0000 (UTC) Cc: "help-gnu-emacs@gnu.org List" To: =?utf-8?B?S2FpIEdyb8Ofam9oYW5u?= , help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Oct 13 18:22:08 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 1VVOQh-0001Kc-Ei for geh-help-gnu-emacs@m.gmane.org; Sun, 13 Oct 2013 18:22:07 +0200 Original-Received: from localhost ([::1]:33748 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VVOQg-0000Us-RF for geh-help-gnu-emacs@m.gmane.org; Sun, 13 Oct 2013 12:22:06 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:54774) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VVOQO-0000Uj-C9 for help-gnu-emacs@gnu.org; Sun, 13 Oct 2013 12:21:56 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VVOQF-0000E5-JF for help-gnu-emacs@gnu.org; Sun, 13 Oct 2013 12:21:48 -0400 Original-Received: from aserp1040.oracle.com ([141.146.126.69]:37831) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VVOQF-0000Dt-CH for help-gnu-emacs@gnu.org; Sun, 13 Oct 2013 12:21:39 -0400 Original-Received: from acsinet21.oracle.com (acsinet21.oracle.com [141.146.126.237]) by aserp1040.oracle.com (Sentrion-MTA-4.3.1/Sentrion-MTA-4.3.1) with ESMTP id r9DGLX8E004065 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sun, 13 Oct 2013 16:21:33 GMT Original-Received: from userz7022.oracle.com (userz7022.oracle.com [156.151.31.86]) by acsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id r9DGLWd4016677 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 13 Oct 2013 16:21:32 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 r9DGLVuT006387; Sun, 13 Oct 2013 16:21:32 GMT In-Reply-To: <525AA42B.6030006@gmx.net> X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.8 (707110) [OL 12.0.6680.5000 (x86)] X-Source-IP: acsinet21.oracle.com [141.146.126.237] 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:93991 Archived-At: > lexical binding allows you to support closures, and with closures > you can do cool things. Yes. And they remove "funarg" problems. > with dynamic binding you can do other cool things (you can let-bind > a variable, then call a function which calls...and the innermost > function will reference the value you just bound -- so you can pass > parameters around without actually having to mention them on every > function call). 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. And that's not only a good thing instead of a bad thing. It is practically the raison d'etre of Emacs: It is a user Lisp environment (which offers editor/UI objects such as buffers and windows). > So each of the styles has their own advantage. Definitely. Those who imagine that a lexical-only approach, a la Scheme, would be a better way to go for Emacs are on the wrong track, IMHO. > I find that the idea that variables declared specially (e.g. with > defvar) can be dynamically bound whereas everything else is > lexically bound by default -- this idea is quite useful. For if > you want to dynamically bind something to influence another > function, you need to know which variables that other function uses > -- and defvar is a good way to document this. Yes, again. Common Lisp showed how to have lexical and dynamic scope cohabit the same programming language. Its approach to this is still a good model to follow. Now if only Emacs Lisp had good namespace control, like Common-Lisp packages...