From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#55156: [PATCH] eval.c: New functions `defvar-f` and `defconst-f` Date: Wed, 27 Apr 2022 18:29:38 -0400 Message-ID: References: <87tuaep47a.fsf@gnus.org> Reply-To: Stefan Monnier Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="26300"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: 55156@debbugs.gnu.org To: Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Apr 28 00:30:13 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1njqAm-0006e9-OT for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 28 Apr 2022 00:30:12 +0200 Original-Received: from localhost ([::1]:48654 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1njqAl-0003q9-AI for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 27 Apr 2022 18:30:11 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:36386) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1njqAd-0003pq-SN for bug-gnu-emacs@gnu.org; Wed, 27 Apr 2022 18:30:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:50826) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1njqAd-00034F-I5 for bug-gnu-emacs@gnu.org; Wed, 27 Apr 2022 18:30:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1njqAd-0007O9-DF for bug-gnu-emacs@gnu.org; Wed, 27 Apr 2022 18:30:03 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 27 Apr 2022 22:30:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 55156 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 55156-submit@debbugs.gnu.org id=B55156.165109858928349 (code B ref 55156); Wed, 27 Apr 2022 22:30:03 +0000 Original-Received: (at 55156) by debbugs.gnu.org; 27 Apr 2022 22:29:49 +0000 Original-Received: from localhost ([127.0.0.1]:44723 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1njqAO-0007NB-Op for submit@debbugs.gnu.org; Wed, 27 Apr 2022 18:29:48 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:52175) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1njqAM-0007My-Bs for 55156@debbugs.gnu.org; Wed, 27 Apr 2022 18:29:47 -0400 Original-Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 856C410019F; Wed, 27 Apr 2022 18:29:40 -0400 (EDT) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 34E841000C4; Wed, 27 Apr 2022 18:29:39 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1651098579; bh=647+BJ5rIL+51VdEhjYyRPO+il3YSiTLrNsX3u8YpZc=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=VNI5Akutm8fC4cykMtBRA6/WpMTCZD7Voxzs4swi2zlyDRE3rMpMIH+8C1vnyqhDX CdZQIj2eulmjTzz1ZfP6cTlJhX7d98b+JDsJsZguC1HEWa7gBEUuJenwebpVTKySqd puMC+7OlEf/4zy0wBI9jlPlcBJ+db6NDY16Oph3r2aepgHzPTzrmJDy5vlZL52K23U VuW0Rgixf63Ed5Yvg8mhu6RfC79OWSqYdPBfQit1MuzEoylB+uqerDL6Qr7hd9FUBU JafIRJZAwSU2BLv1D64DufbS3exiTWAYd85RUdoPyCYJ4RBu+j+vddcc7hTKuIGod/ NlInJmodUc30g== Original-Received: from alfajor (lechon.iro.umontreal.ca [132.204.27.242]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 1C850120298; Wed, 27 Apr 2022 18:29:39 -0400 (EDT) In-Reply-To: <87tuaep47a.fsf@gnus.org> (Lars Ingebrigtsen's message of "Thu, 28 Apr 2022 00:11:05 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:230820 Archived-At: Lars Ingebrigtsen [2022-04-28 00:11:05] wrote: > Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of > text editors" writes: > >> This sounds scary, but the reality is less so: while the behavior of >> the special form obeyed its doc in this respect, the behavior of the >> convoluted code generated by the byte-compiler did not(!) and always >> evaluated the part anyway. So this patch also aligns the two >> semantics to provide the same behavior. > > Uhm -- are you saying that if you load an .elc file twice, the > 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* :-( 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). Stefan