91 ms·
> Bedrock now uses the lexical-binding: t cookie in all its .el files. This is the right thing to do if you wrote your .el files recently and assumed lexical-b
by dreamcompiler 9d ago
> Bedrock now uses the lexical-binding: t cookie in all its .el files.
This is the right thing to do if you wrote your .el files recently and assumed lexical-binding was true and you understand the implications thereof.
OTOH if your .el files are older and written before lexical binding was possible, it's best to set the cookies of those files to nil. Or go over them with a fine-toothed comb and rewrite them (if necessary) for lexical binding.
- setopt 8d ago> 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?
- dreamcompiler 8d agoAbsolutely 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/Lexical-Binding.html https://www.gnu.org/software/emacs/manual/html_node/elisp/Le...