From: Lars Ingebrigtsen <larsi@gnus.org>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: 55156@debbugs.gnu.org
Subject: bug#55156: [PATCH] eval.c: New functions `defvar-f` and `defconst-f`
Date: Thu, 28 Apr 2022 00:33:47 +0200 [thread overview]
Message-ID: <87pml2p35g.fsf@gnus.org> (raw)
In-Reply-To: <jwv1qxiyxs8.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Wed, 27 Apr 2022 18:29:38 -0400")
Stefan Monnier <monnier@iro.umontreal.ca> writes:
>> Uhm -- are you saying that if you load an .elc file twice, the <exp>
>> parts in the defvars will be evaluated twice?
>
> Try:
>
> (let ((f (byte-compile
> '(lambda (x)
> (defvar sm-x (progn (message "hello %S" x) x))))))
> (funcall f 5)
> (funcall f 6))
>
> and check *Messages* :-(
Oh, if we call a function containing the defvar... Yes, that's probably
rare enough that nobody's noticed.
I tried to byte-compile a file and just load the .elc a few times, and
the message was only done once:
(defvar this-thing (message "hello"))
> If we prefer keeping the behavior we currently promise, we can of course
> do that (just change `defvar-f` so it takes a function of no argument as
> second arg, it makes the generated code (and the C code) a bit less
> simple, but it's no worse than what we currently have).
I think I'd prefer keeping the behaviour we currently promise, but I
don't have a strong opinion.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
next prev parent reply other threads:[~2022-04-27 22:33 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-27 21:46 bug#55156: [PATCH] eval.c: New functions `defvar-f` and `defconst-f` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-04-27 22:11 ` Lars Ingebrigtsen
2022-04-27 22:29 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-04-27 22:33 ` Lars Ingebrigtsen [this message]
2022-04-28 1:29 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-04-28 5:44 ` Eli Zaretskii
2022-04-29 3:10 ` Richard Stallman
2022-04-28 5:34 ` Eli Zaretskii
2022-04-28 13:26 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-04-28 13:30 ` Lars Ingebrigtsen
2022-04-28 13:33 ` Lars Ingebrigtsen
2022-04-28 13:45 ` Eli Zaretskii
2022-04-29 3:10 ` Richard Stallman
2022-05-25 20:38 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-05-26 5:01 ` Eli Zaretskii
2022-05-27 1:27 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-04-29 3:10 ` Richard Stallman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87pml2p35g.fsf@gnus.org \
--to=larsi@gnus.org \
--cc=55156@debbugs.gnu.org \
--cc=monnier@iro.umontreal.ca \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).