[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Declaring a local dynamic variable?
From: |
Andreas Röhler |
Subject: |
Re: Declaring a local dynamic variable? |
Date: |
Sat, 12 Oct 2013 18:54:40 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux i686; rv:24.0) Gecko/20100101 Thunderbird/24.0 |
Am 25.09.2013 14:26, schrieb Stefan Monnier:
So in essence Emacs doesn't really have local dynamic variables?
Dynamic scoping is inherently global,
Reads like a mistake for me.
What about saying scope and art-of-binding are unrelated?
Please consider the following
(defvar a nil)
(setq a 2)
(defun foo (&optional a)
(let ((a (or a 0)))
(message "%d" a)
(bar)))
(defun bar ()
(setq a 1))
(foo)->
0
1
;; setq a 1 worked, because of dynamic binding at a local var
a->
2
Global a is not affected, because of the let-binding, which is obviously not
global.
- Re: Declaring a local dynamic variable?,
Andreas Röhler <=