Subject: Re: bug#30078: 27.0.50; Use lexical-binding for M-:

From: Robert Cochran <[email-masked]>
Date: Sat, 13 Jan 2018 21:58:48 -0800

Eli Zaretskii <[email-masked]> writes:

>> From: Luis Gerhorst <[email-masked]>
>> Date: Sat, 13 Jan 2018 18:50:36 +0100
>> Cc: Eli Zaretskii <[email-masked]>, [email-masked],
>>  [email-masked]
>> 
>> 1) Make Elisp more approachable to newcomers. Lexical binding is the default
>> in most programming languages and thus more people are familiar with it. This
>> makes it easier for people to understand existing code since they don‘t have
>> to get used to implicit dynamic binding first, which the code may take
>> advantage of.
>
> Do we know for a fact that most users who extend Emacs by writing
> their own Lisp have background in Lisps and other similar languages
> where lexical binding is the default?  If not, dynamic binding might
> be easier to grasp for the newcomers.

I learned Emacs Lisp by learning Common Lisp first when I set out to
learn it. Prior to that, I had been programming in languages that have
lexical scoping as the primary scope mechanism. I personally do not know
of non-Lisp languages that have variables that work like dynamic
variables do.

And of course I can't comment from the perspective from a newcommer any
more, but I'd be of the mind that entirely dynamic binding would be
/less/ easy to grasp, because it does things that I personally find
non-intuitive in certain circumstances. I have programmer friends that
use Emacs but don't do their own Emacs Lisp, and I would hazard a guess
that dynamic bindings would be unintuitive when they differ from lexical
bindings in behavior.

IMO, the fact that dynamic bindings happen to do the same thing as
lexical bindings is the reason the whole thing isn't nearly as confusing
as it could be.

That's not to say that dynamic bindings are bad - far from it. Dynamic
bindings are really useful. But I think that the potentially confusing
behavior should be opt-in, not opt-out.

-- 
~Robert Cochran

GPG Fingerprint - BD0C 5F8B 381C 64F0 F3CE  E7B9 EC9A 872C 41B2 77C2