emacs-devel
[Top][All Lists]
Advanced

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

Re: lexical-binding is turned on in more use cases


From: Richard Stallman
Subject: Re: lexical-binding is turned on in more use cases
Date: Tue, 10 Mar 2020 23:06:38 -0400

[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

  > (defun my-make-counter ()
  >   (let ((counter 0))
  >     (lambda () (setq counter (1+ counter)))))

  > (setq mc (my-make-counter))

  > (funcall mc) => 1
  > (funcall mc) => 2 ; etc.

  > If you eval (my-make-counter) with lexical-binding off, the result is
  > not functional.

It is clear that my-make-counter needs to be run with lexical binding.
The closure it returns also needs to be run with lexical binding.

However, it seems like a bug that the lexical-dynamic mode in effect
around the _call_ to my-make-counter has any effect on how it runs.
It seems to me that if the definition of my-make-counter comes from a
file that specifies lexical, it should run with lexical bindings
regardless of where it is called from.

-- 
Dr Richard Stallman
Chief GNUisance of the GNU Project (https://gnu.org)
Founder, Free Software Foundation (https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)





reply via email to

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