emacs-bug-tracker
[Top][All Lists]
Advanced

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

bug#50738: closed (`ert-deftest` bodies should not use lexical-binding=n


From: GNU bug Tracking System
Subject: bug#50738: closed (`ert-deftest` bodies should not use lexical-binding=nil)
Date: Sat, 25 Sep 2021 18:34:03 +0000

Your message dated Sat, 25 Sep 2021 20:33:49 +0200
with message-id <F3184B9D-A845-4BA4-A7AF-9212C2F2E228@acm.org>
and subject line Re: bug#50738: `ert-deftest` bodies should not use 
lexical-binding=nil
has caused the debbugs.gnu.org bug report #50738,
regarding `ert-deftest` bodies should not use lexical-binding=nil
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs@gnu.org.)


-- 
50738: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=50738
GNU Bug Tracking System
Contact help-debbugs@gnu.org with problems
--- Begin Message --- Subject: `ert-deftest` bodies should not use lexical-binding=nil Date: Wed, 22 Sep 2021 13:13:58 +0200
Contrary to the expectations of everybody, the body of `ert-deftest` is always 
run with `lexical-binding` bound to nil regardless of what the file uses. This 
bug keeps causing trouble and it's high time we did something about it.

The technical reason for this snag is that the body is evaluated inside a 
`with-temp-buffer` clause (see `ert--run-test-internal`). Some options, ordered 
in roughly decreasing order of desirability (subjective):

1. Make with-temp-buffer use the current value of lexical-binding for the 
temporary buffer, instead of always using nil.
2. Make ert-deftest bodies use lexical-binding=t.
3. Make ert-deftest bodies use the file value of lexical-binding.

Although the last option looks sensible at first glance it's a bit messy in 
practice because of how ERT works (the value of lexical-binding needs to be 
threaded through various data structures) and shouldn't we migrate to 
lexical-binding anyway?





--- End Message ---
--- Begin Message --- Subject: Re: bug#50738: `ert-deftest` bodies should not use lexical-binding=nil Date: Sat, 25 Sep 2021 20:33:49 +0200
23 sep. 2021 kl. 07.50 skrev Eli Zaretskii <eliz@gnu.org>:

> I think it's dangerous to do this in Emacs 28.  After all, the
> original issue is with ERT, whereas the change will affect gobs of
> code.  After the emacs-28 branch is cut, if you feel adventurous, ...

I agree, let's stick to fixing ERT now. Now done: in the most conservative way, 
using the ambient value of lexical-binding.



--- End Message ---

reply via email to

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