help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: DynamicBindingVsLexicalBinding


From: Phillip Lord
Subject: Re: DynamicBindingVsLexicalBinding
Date: Mon, 14 Oct 2013 12:15:03 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

Andreas Röhler <andreas.roehler@easy-emacs.de> writes:
> in article
>
> http://www.emacswiki.org/emacs/DynamicBindingVsLexicalBinding
>
> it's said WRT lexical binding
>
> "Because it's (1) much easier for the user [that is, programmer], because
> it eliminates the problem of which variables lambda-expressions use
> (when they attempt to use variables from their surrounding context)"
>
> Unfortunately couldn't find a use-case where it is easier - while consenting 
> it might be easier for the compiler to swallow.
>
> Could someone give an example, where lexical binding makes coding easier?


The point is that you can determine, by reading the code, where the
value of a variable could be changed. You cannot do this with dynamic
binding, because it depends on the execution path.

As a second point, lexical scoping gives you closures which are nice.

Interesting, although lexical binding is pretty much standard now,
exceptions have the same problems (and benefits) as dynamic binding; you
cannot tell where an exception will be handled by looking at the code.

Phil




reply via email to

[Prev in Thread] Current Thread [Next in Thread]