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

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

bug#44103: 28.0.50; [feature/native-comp] let-bound dynamic variables ar


From: Andrea Corallo
Subject: bug#44103: 28.0.50; [feature/native-comp] let-bound dynamic variables are optimized away
Date: Tue, 20 Oct 2020 19:27:02 +0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Kisaragi Hiu via "Bug reports for GNU Emacs, the Swiss army knife of
text editors" <bug-gnu-emacs@gnu.org> writes:

> --text follows this line--
>
> Some functions use a dynamic (special, marked with defvar) variable to
> change their behaviors. In a lexically bound file, those dynamic
> variable bindings are currently optimized away.
>
> # Reproduction
>
> Run this function with the interpreter:
>
> ```elisp
> (defun k/test ()
>   (with-current-buffer (get-buffer-create "testing")
>     (erase-buffer)
>     (let ((data '((a . "b") (c . "b")))
>           (json-encoding-pretty-print t))
>       (insert (json-encode data)))))
> ```
>
> the contents of #<buffer "testing"> after running `(k/test)` should be
>
> ```
> {
>   "a": "b",
>   "c": "b"
> }
> ```
>
> whereas if you native-compile the code, the contents would become
>
> ```
> {"a":"b","c":"b"}
> ```
>
> because `json-encoding-pretty-print` is optimized away (I think).

Hi Kisaragi,

I just tried native compiling this function but the result for me is the
first one (the expected).

Could you share a full recipe starting from emacs -Q to reproduce this
behavior?

Thanks!

  Andrea





reply via email to

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