[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: DynamicBindingVsLexicalBinding
From: |
Phillip Lord |
Subject: |
Re: DynamicBindingVsLexicalBinding |
Date: |
Wed, 16 Oct 2013 13:57:38 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) |
Kai Großjohann <kai.grossjohann@gmx.net> writes:
> Phillip Lord wrote:
>>
>> None the less, I think you are hitting a strawman here; if Emacs went
>> entirely lexically bound, I don't think that it necessarily follows that
>> elisp will turn into Java.
>
> Sorry, Phil, that's not what I meant. I think I got carried away a
> little there.
Not at all. It was very poetic!
> Even if Emacs were to move to Guile: Scheme has fluid-let.
>
> All I wanted to point out is that this idea of dynamic binding is more
> powerful than one might think at first.
Perhaps my understanding is not complete, but I always thought that
dynamic and static binding was about variables that are unbound. If we
have global variables with mutable state, then as far as I can see, you
could do something equivalent with either.
So, this...
(defun perldoc ()
(interactive)
(require 'man)
(let ((manual-program "perldoc"))
(call-interactively 'man)))
is nearly equivalent to
(defun perldoc()
(interactive)
(require 'man)
(let ((old manual-program))
(setq manual-program "perldoc")
(call-interactively 'man)
(setq manual-program old))
If we were multi-threaded, then AFAICT, the let version would be
cleaner -- as the altered manual-program is *only* in the dynamic
environment of the call to the perldoc command. So another call to the
man function would be unaffected. While the second changes global state,
and then changes it back. But, we aren't.
Phil
- Re: DynamicBindingVsLexicalBinding, (continued)
- Re: DynamicBindingVsLexicalBinding, Andreas Röhler, 2013/10/13
- Re: DynamicBindingVsLexicalBinding, Kai Großjohann, 2013/10/13
- RE: DynamicBindingVsLexicalBinding, Drew Adams, 2013/10/13
- Re: DynamicBindingVsLexicalBinding, Phillip Lord, 2013/10/14
- RE: DynamicBindingVsLexicalBinding, Drew Adams, 2013/10/14
- Re: DynamicBindingVsLexicalBinding, Phillip Lord, 2013/10/14
- Re: DynamicBindingVsLexicalBinding, Kai Großjohann, 2013/10/14
- Re: DynamicBindingVsLexicalBinding, Phillip Lord, 2013/10/15
- Re: DynamicBindingVsLexicalBinding, Kai Großjohann, 2013/10/15
- Re: DynamicBindingVsLexicalBinding,
Phillip Lord <=
- Message not available
- Re: DynamicBindingVsLexicalBinding, Barry Margolin, 2013/10/16
- Message not available
- Re: DynamicBindingVsLexicalBinding, Rustom Mody, 2013/10/14
Re: DynamicBindingVsLexicalBinding, Phillip Lord, 2013/10/14
Re: DynamicBindingVsLexicalBinding, Barry Margolin, 2013/10/12