[Top][All Lists]

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

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

From: Michael Heerdegen
Subject: Re: lexical-binding is turned on in more use cases
Date: Wed, 11 Mar 2020 00:41:59 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Alan Mackenzie <address@hidden> writes:

> Would you perhaps like to give me such an example?

Well - anything that relies on lexical-binding.  You can use any
playground example, like

(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.  If the expression to eval defines/binds something
important, this will error or even break a package.

> And I'm angry that such a far reaching change was pushed through without
> open discussion beforehand on emacs-devel.  This seems to happen far too
> often in Emacs development.

Were does M-: break for you with the change?

> I have recently proposed that the lexicality of bindings created in M-:
> (etc.) should be determined by a customisation variable, and have
> offered to code it up.  Would you find this a good solution?

I guess not.

AFAIU scratch has lexical binding on now, I think this is good.  M-:
used to use the lexical binding mode from the buffer it had been called.
Dunno if an alternative would be to turn on lexical binding in more
buffers instead.

But my guess is that you will also not get lucky if you start to get in
touch with code that relies on lexical binding (it gets more) and
customize the new option to turn lexical binding off for evaluation.


reply via email to

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