From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Kai Grossjohann Newsgroups: gmane.emacs.help Subject: Re: Declaring a local dynamic variable? Date: Sat, 12 Oct 2013 14:25:47 -0700 (PDT) Message-ID: <1319c316-9f24-46e1-b774-b7ea11a84ea2@googlegroups.com> References: 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 1381613415 15359 80.91.229.3 (12 Oct 2013 21:30:15 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 12 Oct 2013 21:30:15 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Oct 12 23:30:20 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 1VV6lP-0003jT-Ts for geh-help-gnu-emacs@m.gmane.org; Sat, 12 Oct 2013 23:30:20 +0200 Original-Received: from localhost ([::1]:59415 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VV6lP-0001EE-Gt for geh-help-gnu-emacs@m.gmane.org; Sat, 12 Oct 2013 17:30:19 -0400 X-Received: by 10.224.97.1 with SMTP id j1mr31184358qan.6.1381613148142; Sat, 12 Oct 2013 14:25:48 -0700 (PDT) X-Received: by 10.50.36.67 with SMTP id o3mr239546igj.1.1381613148005; Sat, 12 Oct 2013 14:25:48 -0700 (PDT) Original-Path: usenet.stanford.edu!i2no8995230qav.0!news-out.google.com!9ni31659qaf.0!nntp.google.com!o2no1461454qas.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=188.100.165.77; posting-account=I9e64woAAAAVzkxsw3EYKwEDU5Qp_aCe Original-NNTP-Posting-Host: 188.100.165.77 User-Agent: G2/1.0 Injection-Date: Sat, 12 Oct 2013 21:25:48 +0000 Original-Xref: usenet.stanford.edu gnu.emacs.help:201702 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:93971 Archived-At: On Saturday, October 12, 2013 6:54:40 PM UTC+2, Andreas R=F6hler wrote: > Am 25.09.2013 14:26, schrieb Stefan Monnier: >=20 > >> So in essence Emacs doesn't really have local dynamic variables? >=20 > > Dynamic scoping is inherently global, >=20 > Reads like a mistake for me. I think it makes sense. In a language that has lexical scoping, you can ge= t the effect of dynamic scoping by changing the value of a global variable. (defvar x 5) bla bla (let ((x 6)) yadda yadda) mumble mumble The above code has the same effect as - create global variable x, initialize it to 5 - execute bla bla - change value of x to 6 - execute yadda yadda - change value of x back to 5 - execute mumble mumble But dynamically-scoped let has the advantage that it remembers the old valu= e for you, and it catches all ways that the "yadda yadda" might exit.