Skip to content

Comment on Emacs Bedrock 2.0parent

Comments

and you understand the implications thereof

Isn’t lexical binding the default in more or less all other programming languages?

So for people who don’t understand the implications, and wrote their .el files recently, lexical binding is likely less surprising behavior than the alternative?

Absolutely correct! I find dynamic binding quite annoying in the modern era; it can cause subtle and unexpected errors. Common Lisp switched mainstream Lisp programmers over to lexical binding in the 1980s. Scheme had used it from day one. But Emacs dragged its feet for decades.

In the past I wrote my .el files assuming dynamic binding because lexical binding was not available. Until I have the time and inclination to rewrite that code I mark them with

  lexical-binding: nil
because that was the assumption under which they were written. If you blindly set
  lexical-binding: t
at the top of all your old .el files you're likely to cause errors if that code depended on dynamic binding, e.g. the 'getx' function here:

https://www.gnu.org/software/emacs/manual/html_node/elisp/Le...

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.