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

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

RE: [External] : Re: Printing alist pairs to a dedicated buffur


From: Drew Adams
Subject: RE: [External] : Re: Printing alist pairs to a dedicated buffur
Date: Thu, 25 Apr 2024 15:55:36 +0000

> Don't use `defvar' if it can be avoided
> as that creates global dynamic/special
> variables,

By that logic, don't use defun because
it creates global dynamic functions.

Or defadvice or defalias or defcustom
or defconst or defface or defgeneric or
defgroup or defmacro or defmethod or
defstruct or deftheme or ...  They all
create global, dynamic bindings.

Try to use Emacs (or Haskell or ...
pretty much anything else, for that
matter) without using global, dynamic
bindings.  Then tell us about your
adventure. ;-)

It _can_ be "avoided" entirely.  But no
one does so.

> `setq' creates global static/lexical variables

Not true.

This is what CLTL2 says about setq in Common
Lisp, which uses lexical binding by default,
for variables:

  "The variables are represented as symbols, 
   of course, and are interpreted as 
   referring to static or dynamic instances 
   according to the usual rules. Therefore 
   setq may be used for assignment of both 
   lexical and special variables."

https://www.cs.cmu.edu/Groups/AI/html/cltl/clm/node79.html

And Elisp isn't even "as lexical" as Common
Lisp yet.  As (elisp) "Scoping Rules for
Variable Bindings" says:

  "By default, the local bindings that Emacs 
   creates are "dynamic bindings".
   ...
   The dynamic binding was (and still is)
   the default in Emacs for many years, but 
   lately Emacs is moving towards using 
   lexical binding in more and more places, 
   with the goal of eventually making that 
   the default."

IOW, Elisp hopes to eventually do what Common
Lisp does - and has done - for 40 years.



reply via email to

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