From unknown Sat Aug 16 14:30:33 2025 X-Loop: help-debbugs@gnu.org Subject: bug#49291: [akater] [PATCH] lisp/emacs-lisp/eieio.el (initialize-instance): Fix initform Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 30 Jun 2021 13:33:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 49291 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: 49291@debbugs.gnu.org Cc: akater X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.162505997224293 (code B ref -1); Wed, 30 Jun 2021 13:33:02 +0000 Received: (at submit) by debbugs.gnu.org; 30 Jun 2021 13:32:52 +0000 Received: from localhost ([127.0.0.1]:56961 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lyaKh-0006Jk-Pi for submit@debbugs.gnu.org; Wed, 30 Jun 2021 09:32:52 -0400 Received: from lists.gnu.org ([209.51.188.17]:45668) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lyaKf-0006Jd-Pn for submit@debbugs.gnu.org; Wed, 30 Jun 2021 09:32:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34810) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lyaKZ-0001XG-Lm for bug-gnu-emacs@gnu.org; Wed, 30 Jun 2021 09:32:45 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:33466) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lyaKT-0002rH-3i for bug-gnu-emacs@gnu.org; Wed, 30 Jun 2021 09:32:41 -0400 Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 402B8440686; Wed, 30 Jun 2021 09:32:35 -0400 (EDT) Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 3186F440642; Wed, 30 Jun 2021 09:32:33 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1625059953; bh=DiL6eJ2OfCuYyjMDlC4qIxz7EbPdMOwY4XT+UcAL6Sw=; h=From:To:Cc:Subject:Date:From; b=KquA+k6phDs8WHUI+Bmi+4K8mNAbaO0kMvYDACDc+eGRo8BGkRWDlFbFc0TNLqHiw AMYOTe0agmQn1kKxiCJixBUdTP+jWTgwshdPJ29UMekr6t/5n/K0SRofGgwz3C56kH 6Cd66pTIH/QdVH1deUIO1q2Z/bnQDEB/hBSXbhlUdnHtg4N73RC4bPHVX3KHAYRju4 GBqgaZps4VWpqGuokNpg5PFiv1KZp60BJNnddoFxLAt1wpRdxSLDI6FdMOyc1niJ3I zH2C63TFL3pYOKZGxU/NIhcfc67kwQmLZGhxDJOhbXpplE98chQ8EwgR3xsINXIaIn NenBhj1r9Imfw== Received: from alfajor (unknown [45.72.205.238]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id F3DB21203BF; Wed, 30 Jun 2021 09:32:32 -0400 (EDT) From: Stefan Monnier Message-ID: Date: Wed, 30 Jun 2021 09:32:32 -0400 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===-=-=" X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL -0.038 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain X-SPAM-LEVEL: Received-SPF: pass client-ip=132.204.25.50; envelope-from=monnier@iro.umontreal.ca; helo=mailscanner.iro.umontreal.ca X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) --===-=-= Content-Type: text/plain Better make it an actual bug report, so we have a bug-number. Stefan --===-=-= Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 8bit From: akater To: emacs-devel@gnu.org Subject: [PATCH] lisp/emacs-lisp/eieio.el (initialize-instance): Fix initform Date: Wed, 30 Jun 2021 12:45:27 +0000 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" --==-=-= Content-Type: text/plain --==-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQJLBAEBCgA1FiEEgu5SJRdnQOF34djNsr6xYbHsf0QFAmDcZ2wXHG51Y2xlYXJz cGFjZUBnbWFpbC5jb20ACgkQsr6xYbHsf0QhbA//ULQ7a2n6L1nEbnh9jygKOmck S9dWpp2S+bkkNdrZFRq9jv3qBzUAdvw4/gEBnJdZQpmkMgKi63TW43zQYe7KDFQf vrLq1Pawj3q7TGEj8t4KIawqBbRp69n2upyY3eOrmqGitF+qj5X8HO4FKnd5I8i+ 5fvfJYMm6GsVVbsBcnz4ddo2nZFr60t7URXTd3lr86P3K5ZS6/FjwphXXdwyyA4Y QgsRKN97lnrk+I1iY+O/Edg7BlLyF1az4SIxP5Bv590wzpMSKOW8kCziUHsP3AMd +SNlX1ee0UM/d3v1l7Abn0PD32WU1gZcPiGYmcUtN8tHthtIgfT1lwekV0BL9R3p SdmZ9klN4f3exGRc3wtZmLSkj/e+ZeW+C8ns8dHuBZe+SS8kpkUlECah765Pg6lU 5CMLCWA9RF6sCjetzHsof407iNStEZE3XELgmBU65eT/RJhJW+w90yMax9EAYpKk VG9xJFtMMF0WdmTc3fTs6d1F9ULwIkZfaa+FzzFaDrMhXjDgr9liUSTRZEeTUrXe DWUUbHp1wjxLWl2BSAImo8KOH7sIDbrFuUQAhT5dwesxVmRbg9sWAsRHvJqfVFDP CSKqq7iNedxnoIs13eWZgjcEI+lfxFBccqslE85dkZFjJJrAKeEq+vqLEAsPe28D 77OxFRB3hc3LDYv+kMY= =WjkX -----END PGP SIGNATURE----- --==-=-=-- --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-lisp-emacs-lisp-eieio.el-initialize-instance-Fix-ini.patch Content-Description: Fix eval initform >From 595083dac6dd0fe3446e182c710fbb2a5a648994 Mon Sep 17 00:00:00 2001 From: akater Date: Wed, 30 Jun 2021 11:43:23 +0000 Subject: [PATCH] lisp/emacs-lisp/eieio.el (initialize-instance): Fix initform: Do not evaluate initform of a slot when initarg for the slot is provided. According to the following secitons of CLHS: - Object Creation and Initialization - Initialization Arguments - Defaulting of Initialization Arguments - Rules for Initialization Arguments --- lisp/emacs-lisp/eieio.el | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lisp/emacs-lisp/eieio.el b/lisp/emacs-lisp/eieio.el index 1c8c372aae..758bddd592 100644 --- a/lisp/emacs-lisp/eieio.el +++ b/lisp/emacs-lisp/eieio.el @@ -740,7 +740,7 @@ defclass eieio-default-superclass nil "Construct the new object THIS based on SLOTS.") (cl-defmethod initialize-instance ((this eieio-default-superclass) - &optional slots) + &optional slots) "Construct the new object THIS based on SLOTS. SLOTS is a tagged list where odd numbered elements are tags, and even numbered elements are the values to store in the tagged slot. @@ -756,13 +756,15 @@ defclass eieio-default-superclass nil (dotimes (i (length slots)) ;; For each slot, see if we need to evaluate it. (let* ((slot (aref slots i)) + (slot-name (eieio-slot-descriptor-name slot)) (initform (cl--slot-descriptor-initform slot))) ;; Those slots whose initform is constant already have the right ;; value set in the default-object. - (unless (macroexp-const-p initform) + (unless (or (rassq slot-name + (eieio--class-initarg-tuples this-class)) + (macroexp-const-p initform)) ;; FIXME: We should be able to just do (aset this (+ i ) dflt)! - (eieio-oset this (cl--slot-descriptor-name slot) - (eval initform t)))))) + (eieio-oset this slot-name (eval initform t)))))) ;; Shared initialize will parse our slots for us. (shared-initialize this slots)) -- 2.31.1 --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable * Summary According to CLHS, #+begin_quote A default initial value form for a slot is defined by using the :initform slot option to defclass. If no initialization argument associated with that slot is given as an argument to make-instance or is defaulted by :default-initargs, this default initial value form is evaluated in the lexical environment of the defclass form that defined it, and the resulting value is stored in the slot. #+end_quote --- [[clhs::07_a.htm][Object Creation and Initialization]] This is not what happens in eieio. Rather, initform is evaluated even when initarg is present. * Emacs Lisp examples Define a class with a slot that has an initarg and an initform involving undefined function: #+begin_src emacs-lisp (defclass test-initform () ((test-slot :initarg :test-slot :initform (identity (non-existent))))) #+end_src Now, #+begin_src emacs-lisp :results code :wrap example emacs-lisp (condition-case err (make-instance 'test-initform :test-slot 0) (t err)) #+end_src #+RESULTS: #+begin_example emacs-lisp (void-function non-existent) #+end_example Even though initform should not be evaluated since initarg is provided. * Other references from CLHS #+begin_quote If the initialization argument has a value in the initialization argument list, the value is stored into the slot of the newly created object, overriding any :initform form associated with the slot. #+end_quote --- [[clhs::07_aa.htm][Initialization Arguments]] #+begin_quote An :initform form is used to initialize a slot only if no initialization argument associated with that slot is given as an argument to make-instance or is defaulted by :default-initargs. #+end_quote --- [[clhs::07_ac.htm][Defaulting of Initialization Arguments]] #+begin_quote If a slot has both an :initform form and an :initarg slot option, and the initialization argument is defaulted using :default-initargs or is supplied to make-instance, the captured :initform form is neither used nor evaluated. #+end_quote --- [[clhs::07_ad.htm][Rules for Initialization Arguments]] * Common Lisp examples Define a class in exactly the same way as in Emacs Lisp: #+begin_src lisp :results errors :wrap example lisp (defclass test-initform () ((test-slot :initarg :test-slot :initform (identity (non-existent))))) #+end_src #+RESULTS: #+begin_example lisp ; in: DEFCLASS TEST-INITFORM ; (NON-EXISTENT) ;=20 ; caught STYLE-WARNING: ; undefined function: COMMON-LISP-USER::NON-EXISTENT ;=20 ; compilation unit finished ; Undefined function: ; NON-EXISTENT ; caught 1 STYLE-WARNING condition #+end_example Appropriately, #+begin_src lisp :results value verbatim :wrap example lisp (ignore-errors (make-instance 'test-initform)) #+end_src #+RESULTS: #+begin_example lisp NIL # #+end_example But with initarg, there is no need to evaluate initform, and it is not evaluated: #+begin_src lisp :results value verbatim :wrap example lisp (make-instance 'test-initform :test-slot 0) #+end_src #+RESULTS: #+begin_example lisp # #+end_example * Notes ** Initializing to quoted initform Emacs 27 source claims: #+begin_quote Paul Landes said in an email: > CL evaluates it if it can, and otherwise, leaves it as > the quoted thing as you already have. This is by the > Sonya E. Keene book and other things I've look at on the > web. #+end_quote --- [[file:/usr/share/emacs/27.2/lisp/emacs-lisp/eieio.el::;; Paul Landes s= aid in an email:][EIEIO on initform quoting]] And eieio does quote initform forms with cars being symbols that are not fb= ound: #+begin_src lisp :results none (defclass test-initform-quote () ((test-slot :initform (non-existent)))) #+end_src #+begin_src emacs-lisp :results code :wrap example emacs-lisp (slot-value (make-instance 'test-initform-quote) 'test-slot) #+end_src #+RESULTS: #+begin_example emacs-lisp (non-existent) #+end_example There is however no reference to Sonya E. Keene or anything else. Meanwhil= e, #+begin_src lisp :results errors :wrap example lisp (defclass test-initform-quote () ((test-slot :initform (non-existent)))) #+end_src #+RESULTS: #+begin_example lisp ; in: DEFCLASS TEST-INITFORM-QUOTE ; (NON-EXISTENT) ;=20 ; caught STYLE-WARNING: ; undefined function: COMMON-LISP-USER::NON-EXISTENT ;=20 ; compilation unit finished ; Undefined function: ; NON-EXISTENT ; caught 1 STYLE-WARNING condition #+end_example #+begin_src lisp :results value verbatim :wrap example emacs-lisp (ignore-errors (make-instance 'test-initform-quote)) #+end_src #+RESULTS: #+begin_example emacs-lisp NIL # #+end_example Also, when discussing interplay between initform and default-initargs, Sony= a E. Keene mentions: #+begin_quote The value of an :initform is evaluated each time it is used to initialize a= slot. #+end_quote --- Sonya E. Keene, Object Oriented Programming in Common Lisp: A Programmer's Guide. 9.3. Controlling Initialization With ~defclass~ Options similarly stated in CLHS, in =E2=80=9CMacro DEFCLASS=E2=80=9D. Emacs 28 source removes the claim but adds #+begin_quote FIXME: Historically, EIEIO used a heuristic to try and guess whether the initform is a form to be evaluated or just a constant. We use `eieio--eval-default-p' to see what the heuristic says and if it disagrees with normal evaluation then tweak the initform to make it fit and emit a warning accordingly. #+end_quote --- [[file:~/src/emacs/lisp/emacs-lisp/eieio.el::;; FIXME: Historically, EI= EIO used a heuristic to try and guess][eieio in git]] which arguably makes matters even more confusing. There should be no such heuristic. * Patch We offer a patch for Emacs 28 (master) but we can't build Emacs 28 (the bug had been filed) so it's untested and =E2=80=9Cworks for me=E2=80=9D. --=-=-=-- --===-=-=-- From unknown Sat Aug 16 14:30:33 2025 X-Loop: help-debbugs@gnu.org Subject: bug#49291: [akater] [PATCH] lisp/emacs-lisp/eieio.el (initialize-instance): Fix initform Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 30 Jun 2021 15:17:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 49291 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: 49291@gnu.org Cc: akater Received: via spool by 49291-submit@debbugs.gnu.org id=B49291.162506621920005 (code B ref 49291); Wed, 30 Jun 2021 15:17:01 +0000 Received: (at 49291) by debbugs.gnu.org; 30 Jun 2021 15:16:59 +0000 Received: from localhost ([127.0.0.1]:58491 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lybxS-0005Ca-SC for submit@debbugs.gnu.org; Wed, 30 Jun 2021 11:16:59 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:55225) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lybxQ-0005CN-3l for 49291@debbugs.gnu.org; Wed, 30 Jun 2021 11:16:58 -0400 Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 1FB3B8064E; Wed, 30 Jun 2021 11:16:50 -0400 (EDT) Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id D431E80A5C; Wed, 30 Jun 2021 11:16:47 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1625066207; bh=nRkcXIm0U1vnaTMnYsE/Veqsog9QQpNDCm5nHGHxuDw=; h=Resent-To:Resent-From:Resent-Date:From:To:Cc:Subject:References: Date:In-Reply-To:From; b=O1S9SFpY8TikVKp+ursFWq8OYLg5XjCwQh8AERr+X12/FBclAaf+CNYj4+ugTGeLz 0Dxz0zMPgsbbPDFASIppA23p71zazH6zukTdanbfKMH1w65fH/y6/3ZtrN0G+WfQ0g gvcRQhg2tYo8pGQNejM+OXM96UxBeQKxCkqdZDwoBK2kQ37oGLgFFv5EEyJcnINdYP kDUkxBAnZkwWQd44sgjHCBF83DE+ltUu+tCwSh6l4/+rAtcwMNZzri+UlhUtZTkMzG G85v4L2RE95N1vduNVDQCVg+Gz9hrcYKuUIsS26Djcl/XTcBHB5SY6kJzGjqjBq2Et vb5Pf4IfAYqrg== Received: from alfajor (unknown [45.72.205.238]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id A41851202DA; Wed, 30 Jun 2021 11:16:47 -0400 (EDT) Resent-Message-ID: Resent-To: 49291@debbugs.gnu.org Resent-From: Stefan Monnier Resent-Date: Wed, 30 Jun 2021 11:16:42 -0400 Received: from mail01.iro.umontreal.ca by mail01.iro.umontreal.ca with LMTP id cNZZGSR03GAKUwAASs+2LQ (envelope-from ) for ; Wed, 30 Jun 2021 09:39:48 -0400 Received: from mailscanner.iro.umontreal.ca (pmg1.iro.umontreal.ca [172.31.2.40]) by mail01.iro.umontreal.ca (Postfix) with ESMTPS id 4EE8E140E6B for ; Wed, 30 Jun 2021 09:39:48 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1625060388; bh=nRkcXIm0U1vnaTMnYsE/Veqsog9QQpNDCm5nHGHxuDw=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=Uu978xetG77ScJT6BMsMzURMxbNqagJ3vKFcMPMeAWrJJpiCIF3++hug24SrY6A44 meM+DSwkgrADujRxkIsgWq3CQLlCGXxT5CJNJsH65cTcCDgi7Us5TCHUnKoRsFR+Iu jIbUYQFW+/i8NOvq1UDvE2Uk6tmsakp+RTolIwjl3BeCbnEKn+/m14S4fkE6oChNMi yZnCmBmWKWWEipLvdOyzjpxGfRrI3JVutO/EAlAtxrDJ7lkPacm8qFMsy0uxVvYvVi JDcUKc/38X2vh/+tkYCoXL55axRpz6908jzbXBsW9BXzXo3PWGWE1Lk7cV0oIGJ+xf 5iEKlePPPtlbQ== Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 1C89D1001F9; Wed, 30 Jun 2021 09:39:48 -0400 (EDT) Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 483A4100040; Wed, 30 Jun 2021 09:39:47 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1625060387; bh=nRkcXIm0U1vnaTMnYsE/Veqsog9QQpNDCm5nHGHxuDw=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=esTWfUQsj1So9WzcVyZfaC1HaPLQwCIzgmZ0B57PLXAKz3kz3xYs2inUhth6S04mt fpiXTxn3D2gpz2Ig9jE7YFBURakIyiaz1skVq7lDVJLRTIG9v6f9XwyYMRiFcAMfnU zYMTOLUpE6fz6zWSUt3eCZ6LZANKh1crGqpyKBoIIMNMeoF9MmVVKl5RehN5d+CsC4 aXoS6lVbOmgnorx8cd07/JnZKtgDrf3VF28DmMyba0nfRZmf/9mhdo1f6l5ProXKao D/tbGDCUfeXNymukYWmPcp6XxNZ5cA1LN7pdR0TG7ZyVyC48p1LbJ1H07HiM8le4nR 1GsYtWvarjivw== Received: from alfajor (unknown [45.72.205.238]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 1379712077D; Wed, 30 Jun 2021 09:39:47 -0400 (EDT) From: Stefan Monnier Message-ID: References: Date: Wed, 30 Jun 2021 09:39:46 -0400 In-Reply-To: (Stefan Monnier's message of "Wed, 30 Jun 2021 09:32:32 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL -0.070 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Stefan Monnier [2021-06-30 09:32:32] wrote: > This is not what happens in eieio. Rather, initform is evaluated even > when initarg is present. Good catch, thanks. > @@ -756,13 +756,15 @@ defclass eieio-default-superclass nil > (dotimes (i (length slots)) > ;; For each slot, see if we need to evaluate it. > (let* ((slot (aref slots i)) > + (slot-name (eieio-slot-descriptor-name slot)) > (initform (cl--slot-descriptor-initform slot))) > ;; Those slots whose initform is constant already have the right > ;; value set in the default-object. > - (unless (macroexp-const-p initform) > + (unless (or (rassq slot-name > + (eieio--class-initarg-tuples this-class)) > + (macroexp-const-p initform)) > ;; FIXME: We should be able to just do (aset this (+ i ) dflt)! > - (eieio-oset this (cl--slot-descriptor-name slot) > - (eval initform t)))))) > + (eieio-oset this slot-name (eval initform t)))))) > ;; Shared initialize will parse our slots for us. > (shared-initialize this slots)) Hmm... if I read this correctly, you prevents the (eval initform t) for all slots that were declared with `:initarg `, whereas AFAIK the right semantic is to prevent the (eval initform t) in the case where the corresponding was passed to `make-instance`. So we should pay attention to `slots` (the arg, not the local var) to decide whether to skip (eval initform t). Stefan From unknown Sat Aug 16 14:30:33 2025 X-Loop: help-debbugs@gnu.org Subject: bug#49291: [akater] [PATCH] lisp/emacs-lisp/eieio.el (initialize-instance): Fix initform Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 30 Jun 2021 15:20:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 49291 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: akater Cc: 49291@debbugs.gnu.org Received: via spool by 49291-submit@debbugs.gnu.org id=B49291.162506634520243 (code B ref 49291); Wed, 30 Jun 2021 15:20:02 +0000 Received: (at 49291) by debbugs.gnu.org; 30 Jun 2021 15:19:05 +0000 Received: from localhost ([127.0.0.1]:58497 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lybzV-0005GR-8Y for submit@debbugs.gnu.org; Wed, 30 Jun 2021 11:19:05 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:43362) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lybzQ-0005Fq-FY for 49291@debbugs.gnu.org; Wed, 30 Jun 2021 11:19:04 -0400 Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 26389100104; Wed, 30 Jun 2021 11:18:55 -0400 (EDT) Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id EB1F8100040; Wed, 30 Jun 2021 11:18:53 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1625066333; bh=2UOJob42o/04zYUyIJLWbMO6hGwhsScsRaQgj63kMRY=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=YswjQpoCFMsoxYBqOPfSiDoKEb/u5TbPBqhMHFRpdRN2Hfh7tjrjvPfPI0elgm5Uu 9klf3layuxduhiZoNA95ckHmXGSKI9Cz/4zi0kzPklR1wQ7Rooa0nWEpNq1TGbk1ja c254lw0+RDIHkiOR+cZKeiofVhAQ226Z9tGC5LLbYGx1/CUP5lxvRgJgrJ7o6nC468 dfA7SiH4jafAFyDOKe8SQPuKckBpeeGAoFKx7keKl7QBhTh2cUO+NUwvqLMAjfId8v kV893dzmCm7dkhhjI92hB1ZJQF8GLmo48zFpIYZTBx6jpa6o2JGFQDcF5pekKQ8CRT d9n7ZUTQjoLTw== Received: from alfajor (unknown [45.72.205.238]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id AE6A0120515; Wed, 30 Jun 2021 11:18:53 -0400 (EDT) From: Stefan Monnier Message-ID: References: <4C8982EC-84B0-45A7-A6F3-2AFE473F9174@gmail.com> Date: Wed, 30 Jun 2021 11:18:52 -0400 In-Reply-To: <4C8982EC-84B0-45A7-A6F3-2AFE473F9174@gmail.com> (akater's message of "Wed, 30 Jun 2021 14:02:01 +0000") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL -0.062 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) akater [2021-06-30 14:02:01] wrote: > You're right, I'll check for `slots`. Got confused as to where initargs > were stored, and lost the check. Sorry, I mistyped the address in my reply, it should be 49291 debbugs.gnu.org instead of 49291 gnu.org From unknown Sat Aug 16 14:30:33 2025 X-Loop: help-debbugs@gnu.org Subject: bug#49291: [akater] Re: [akater] [PATCH] lisp/emacs-lisp/eieio.el (initialize-instance): Fix initform In-Reply-To: Resent-From: akater Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 30 Jun 2021 17:01:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 49291 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: 49291@debbugs.gnu.org Received: via spool by 49291-submit@debbugs.gnu.org id=B49291.162507243330124 (code B ref 49291); Wed, 30 Jun 2021 17:01:01 +0000 Received: (at 49291) by debbugs.gnu.org; 30 Jun 2021 17:00:33 +0000 Received: from localhost ([127.0.0.1]:58646 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lydZg-0007po-Gt for submit@debbugs.gnu.org; Wed, 30 Jun 2021 13:00:32 -0400 Received: from mail-ed1-f42.google.com ([209.85.208.42]:42854) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lydZe-0007pc-Qw for 49291@debbugs.gnu.org; Wed, 30 Jun 2021 13:00:32 -0400 Received: by mail-ed1-f42.google.com with SMTP id n25so4227762edw.9 for <49291@debbugs.gnu.org>; Wed, 30 Jun 2021 10:00:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:references:date:message-id:mime-version; bh=h9v5ODuIKF6Zx79ZYQkp4TiKXalh2XVXR8+UV2SOsVQ=; b=Gt0MhCnvxEY2fIQnNm1E7/1vb31Z5gvU8JQ7Pd+2LNTJSuSDq/6LZL7svVrousvEhO N/npwpKpd8t+lGULL7AK6g9TYtaaxortGBkuOOwRNPhDXHLugY54gUVvSm1yncPg7Ucf 1SekDT8/kymqEXNczqCQfhSXW9Z7DczGmMQCJqjnolToFRAOJAc2xYFZcqaGhApMPHEI IbGSOEgvg7R6mE9TIASXVGpf8SMMHUCr14te6HnWjGDqxzo5iX8rH7GSwQB9zcuxEifr pXMPlb9RbxSNk2qjVqmRK+jO3phbtMcCuEn1VqqQD/akWroVob5z1+Z/hky9iJmM9VXs u6HA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:references:date:message-id :mime-version; bh=h9v5ODuIKF6Zx79ZYQkp4TiKXalh2XVXR8+UV2SOsVQ=; b=lIguNv0QZ70I+Di232umtL8DryahfKXjlJycH9TvsE2l/6T6pPZNkkcBmAusSbkKyO fmRqybakk3AVby1ayv2qXE14Apts34QblCYQyeYieHx+v1vJnmbYs8tfsNUGSWW/ZVl6 RxWHDMr3W2FwxvrwovDTiAy06PUVy9AD503c6Uww848z6uu5Z6pLvqqx8EiQxz5Z9tG7 jbsctqG3vpMlkq4d9ODjyXXK7hYDW8MO79auknt+i7JvHhUdFQ/hIp2Z6Uc4TFpEi2AE cT82DlIABT0jzCzhyAFhJ7ZUtK5D70spMpVFYYefbTRc7b4er4CaAiJHeGwztZQU048y 6Tfg== X-Gm-Message-State: AOAM531g2gfFQIXoSkl+P2YTn8MOS0uqSe1KaE3nCSQxKbSwpmnBkTTk r6kJPjYLF69v+IUlWNejFwNa9MZ0PwXxeg== X-Google-Smtp-Source: ABdhPJyLejRXT66qXkdTYTd9lvVd5d/D4098ewfMA/PaukGJqNInxznlE0CXfs+v740AY80C/t67iA== X-Received: by 2002:a05:6402:14d8:: with SMTP id f24mr1589687edx.195.1625072424908; Wed, 30 Jun 2021 10:00:24 -0700 (PDT) Received: from localhost ([185.220.101.194]) by smtp.googlemail.com with ESMTPSA id y27sm9292906ejk.89.2021.06.30.10.00.23 for <49291@debbugs.gnu.org> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Jun 2021 10:00:24 -0700 (PDT) From: akater References: <875yxvuwtf.fsf@gmail.com> Date: Wed, 30 Jun 2021 16:49:15 +0000 Message-ID: <871r8juwl0.fsf@gmail.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: 1.2 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Start of forwarded message From: akater To: Stefan Monnier , Re: [akater] [PATCH] lisp/emacs-lisp/eieio.el (initialize-instance): Fix initform Date: Wed, [...] Content analysis details: (1.2 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 1.2 RCVD_IN_BL_SPAMCOP_NET RBL: Received via a relay in bl.spamcop.net [Blocked - see ] -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [209.85.208.42 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [209.85.208.42 listed in wl.mailspike.net] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (nuclearspace[at]gmail.com) -0.0 SPF_PASS SPF: sender matches SPF record X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.2 (/) --=-=-= Content-Type: text/plain -------------------- Start of forwarded message -------------------- From: akater To: Stefan Monnier , 49291@gnu.org Subject: Re: [akater] [PATCH] lisp/emacs-lisp/eieio.el (initialize-instance): Fix initform Date: Wed, 30 Jun 2021 16:44:12 +0000 --=-=-= Content-Type: multipart/mixed; boundary="==-=-=" --==-=-= Content-Type: multipart/signed; boundary="===-=-=" --===-=-= Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable There are iusses, some stylistic, some related to comments in the code. - There is a comment here: > First, see if any of our defaults are `lambda', and > re-evaluate them and apply the value to our slots.=20=20=20=20=20=20=20= =20=20=20=20=20=20 I don't observe anything like this happening. Looks like it refers to eieio-default-eval-maybe (likely referring to any compound form with fbound car as to `lambda') which used to be in eieio-core in 27 but now is gone. Maybe we should drop this comment? - There is a comment: > For each slot, see if we need to evaluate it Slots are self-evaluating objects; I think it was meant to be =E2=80=9Cto evaluate its initform=E2=80=9D. - There is FIXME > FIXME: We should be able to just do (aset this (+ i ) dflt)!=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20 Local variable dflt had been removed after Emacs 27 release. The comment should likely have been gone too, or at least updated. It suggests to assign the value of initform with a low-level `aset' applied to eieio--class struct but (1) I don't understand the + i shift (2) eieio--class is not declared to be of :type vector, neither does it inherit from a struct declared to be of :type vector. I suggest to replace the comment with =E2=80=9CTODO: maybe specify eieio--class as vector and use aset here=E2=80= =9D - I employ when-let which requires subr-x at compile time. I can't check the build cleanly right now, only with some dirty reverts related to libseccomp issues but aside from that, this subr-x dependency doesn't break byte-compilation of eieio.el. I hope it's fine? --===-=-= Content-Type: application/pgp-signature; name=signature.asc Content-Transfer-Encoding: base64 LS0tLS1CRUdJTiBQR1AgU0lHTkFUVVJFLS0tLS0KCmlRSkxCQUVCQ2dBMUZpRUVndTVTSlJkblFP RjM0ZGpOc3I2eFliSHNmMFFGQW1EY24yUVhIRzUxWTJ4bFlYSnoKY0dGalpVQm5iV0ZwYkM1amIy MEFDZ2tRc3I2eFliSHNmMFNGbmhBQW9WeEJqUk5KR1ljZUlIWkZFSEZPQmZ1VQpvcVZHQ0laK3lC dHBGWkpGTTRzK05CWG0zTTd5S1R5MjR6MkxDUVVrby9SOENzSjI4aktQSWpwV3JwUG5DNmlvClNW Y0RhWEpPdDkyQndGRmRza1lpWTBSb2c1RkEvYnFYVSt1ZTBveTlXUE9jL1lndlVEY1V6NGtwOTVa WEUycS8KWWlXUXVPZU5OWThwUTdjWENYWi9UMkh1ZlIvRjRtNGt5aVFFNEVjSjk0UGdGOXlpOUVU c3pCN21LdUhHM3R1ZQo0aEFORW54N1ZoMnF5U0hsNmo0bmN6L0tvc0Z5c2N1SXJuZFFPaTUrb21H TUdBOTRpRjd4RFZqRFdNS05SVCs5Ci8vK210dmQ5UnpRbVNkTDVhWmtNMlIrNXgzZzl4cjlaQnRX V0NhZDhkWmlWWGhna0pFOUFhR3k5UHVzM2x5UGYKZm9XS09FVDljT3hBcjdpVDY3VjgrOE9FcDlV R2ZGSUlPVkZReWg4dlB6UkNJVVhvbndNMW9saFZHbms5MElaagp6Qy9nMW9OWDR1UjVBdngvN1BK MlM2N3U5ZWVURzBmekhSWW9nYVBVenkzZWVlV1VEUEZWM3JpNGZQVk1BVXlxClpYcEVJZWlZRnB0 MkpFMFZIcllmK1R0VDh6RWdEL29qRmlxK0xyNVRHRjViaFNVUDZ6dXcwSEZHVDY1Z2hPUWsKSmk2 eXdPdlpMTDdtejZHTUM2d3p4TTl4dnB0eU96SFFtR2g5a2ZaVUluMVVTVWlxR0FRTDNERVBlRWE5 Wk9UWQo1d0UxckdOY1pRUm0rSmhZZlVmWFc5NnZGTWE2WVdmR1AyamZCQW5aNXZJUXlKM2dIQ3Uy anUrKy9ONWYvck1MCnpYMnJGQS9zN3JpamZlSDZoakU9Cj1hTnNXCi0tLS0tRU5EIFBHUCBTSUdO QVRVUkUtLS0tLQ== --===-=-=-- --==-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-lisp-emacs-lisp-eieio.el-initialize-instance-Fix-eva.patch Content-Description: Fix eval initform >From 588e7ff1b34ccfbc9e3cb97d06ae3315487d42c9 Mon Sep 17 00:00:00 2001 From: akater Date: Wed, 30 Jun 2021 11:43:23 +0000 Subject: [PATCH] lisp/emacs-lisp/eieio.el (initialize-instance): Fix eval initform: Do not evaluate initform of a slot when initarg for the slot is provided. According to the following secitons of CLHS: - Object Creation and Initialization - Initialization Arguments - Defaulting of Initialization Arguments - Rules for Initialization Arguments --- lisp/emacs-lisp/eieio.el | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/lisp/emacs-lisp/eieio.el b/lisp/emacs-lisp/eieio.el index 1c8c372aae..ec05a07307 100644 --- a/lisp/emacs-lisp/eieio.el +++ b/lisp/emacs-lisp/eieio.el @@ -53,6 +53,7 @@ defun eieio-version () (message eieio-version)) (require 'eieio-core) +(eval-when-compile (require 'subr-x)) ;;; Defining a new class @@ -740,7 +741,7 @@ defclass eieio-default-superclass nil "Construct the new object THIS based on SLOTS.") (cl-defmethod initialize-instance ((this eieio-default-superclass) - &optional slots) + &optional slots) "Construct the new object THIS based on SLOTS. SLOTS is a tagged list where odd numbered elements are tags, and even numbered elements are the values to store in the tagged slot. @@ -749,20 +750,25 @@ defclass eieio-default-superclass nil to have this constructor called automatically. If these steps are not taken, then new objects of your class will not have their values dynamically set from SLOTS." - ;; First, see if any of our defaults are `lambda', and - ;; re-evaluate them and apply the value to our slots. (let* ((this-class (eieio--object-class this)) + (initargs slots) (slots (eieio--class-slots this-class))) (dotimes (i (length slots)) - ;; For each slot, see if we need to evaluate it. + ;; For each slot, see if we need to evaluate its initform. (let* ((slot (aref slots i)) + (slot-name (eieio-slot-descriptor-name slot)) (initform (cl--slot-descriptor-initform slot))) - ;; Those slots whose initform is constant already have the right - ;; value set in the default-object. - (unless (macroexp-const-p initform) - ;; FIXME: We should be able to just do (aset this (+ i ) dflt)! - (eieio-oset this (cl--slot-descriptor-name slot) - (eval initform t)))))) + (unless (or (eq eieio--unbound initform) + (when-let ((initarg + (car (rassq slot-name + (eieio--class-initarg-tuples + this-class))))) + (plist-get initargs initarg)) + ;; Those slots whose initform is constant already have + ;; the right value set in the default-object. + (macroexp-const-p initform)) + ;; TODO: Maybe specify eieio--class as vector explicitly and use aset + (eieio-oset this slot-name (eval initform t)))))) ;; Shared initialize will parse our slots for us. (shared-initialize this slots)) -- 2.31.1 --==-=-=-- --=-=-= Content-Type: text/plain -------------------- End of forwarded message -------------------- --=-=-= Content-Type: multipart/signed; boundary="====-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" --====-=-= Content-Type: text/plain --====-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQJLBAEBCgA1FiEEgu5SJRdnQOF34djNsr6xYbHsf0QFAmDcoIsXHG51Y2xlYXJz cGFjZUBnbWFpbC5jb20ACgkQsr6xYbHsf0TW0A//bxR0gdtdkzOzglIvl4Xcaevs YLyPPs/eNMzEl6+UmIHQrOgP0TM4NOHF2ij07+Yl7Aa+hr5uEsjTokHldJ+/nZBN 10f2X01V/81ZSw7WvoSlQNzPBpm6MDTssxH0uw9zHam6+8Kz3Migjju6a7g5Yw5M U9ryw/86t74Fxb/aS5vaDqFQtPhZUcroSVU+RFalQRYcsSCBGH3cAnBgS8LSUQHj mQVIi2XrgRyVHVSgTa0ChS6aAgwQQixe7YuyBxsLU7bqhmX1DjGFnpK5DACGmMn1 qr407RkjIM6jdCvOFHpkgdS7NGucRxIctLMhQca5KhGDdo0zw4EQJ4Bo+/Dmkk6x Q0JqiuI/TnF31/YmK8PdSrTgpplbVbAtOBRHPJiRmdzSpt9OGnvoJ8bpSCyAG6A/ A+8rHITVibScfxRFTGKyKzAxfcxnuABeZL9ApF67MUZ5GjtY4xUBTmRNch599WOj WFNgC/4JQThnqi3ALKfdWDwj8nfTlRKCVOeuVYQ0Gyxis6vJQzbpn32gZzuKBjKe /FjZ08xwxNSqloJ2cKmsMGezAYm8SEb871AFmkF/isWuvg9djA2DQjPV3H6uASrh Al1yBdDyscRCo5/ANxpJsJu3Ag5dcwTAreCl7k64nGZK6nSAUcraxdFGyBjaixek mVOqC0FRb06Ck4chaMQ= =ndrl -----END PGP SIGNATURE----- --====-=-=-- --=-=-=-- From unknown Sat Aug 16 14:30:33 2025 X-Loop: help-debbugs@gnu.org Subject: bug#49291: [akater] Re: [akater] [PATCH] lisp/emacs-lisp/eieio.el (initialize-instance): Fix initform References: In-Reply-To: Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 30 Jun 2021 18:59:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 49291 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: 49291@debbugs.gnu.org Received: via spool by 49291-submit@debbugs.gnu.org id=B49291.16250794838432 (code B ref 49291); Wed, 30 Jun 2021 18:59:01 +0000 Received: (at 49291) by debbugs.gnu.org; 30 Jun 2021 18:58:03 +0000 Received: from localhost ([127.0.0.1]:58731 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lyfPP-0002Bw-83 for submit@debbugs.gnu.org; Wed, 30 Jun 2021 14:58:03 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:18024) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lyfPN-0002BR-5I for 49291@debbugs.gnu.org; Wed, 30 Jun 2021 14:58:02 -0400 Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id E6A7F80AA9; Wed, 30 Jun 2021 14:57:54 -0400 (EDT) Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 70DC180A7A; Wed, 30 Jun 2021 14:57:53 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1625079473; bh=MeTus0C1aaAC5uj0H/8Lf4z1n1Ka+2FVwv02zsq+7IA=; h=From:To:Subject:Date:From; b=CTnIdaVVEAeHamBSXMRveMjJEV15/odL0BYNwy9rTmVicHbmoO+8CsaR1UUUBsao1 4UZ4Gh/VxCVa4DaC/urKnQAzg4GhuYU/KHcmfSZoh3cZe4Tvs28RZOTQXFcXlwHQCT rFkYfE0nA6I1ZbPtHzdJq1vgGVhib/GFFJX8T3OV/IMJsQgy/WPVrZB/m+mkZs2O0z CbDmmMUgmQO2ZXPgFz1bOHsjA7+mw8C3fdO+1/sySQP92DpPiHtntTEweNIFDDzwwB xxGUHwaKFLD6QoPsbrnrmouNbTrSc38TGG9tBE46HXo6hfLCwcuSRra1a0y0btwibe D6cCQ415+Vxqg== Received: from alfajor (unknown [45.72.205.238]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 3D36C1202A0; Wed, 30 Jun 2021 14:57:53 -0400 (EDT) From: Stefan Monnier Message-ID: Date: Wed, 30 Jun 2021 14:57:52 -0400 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===-=-=" X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL -0.070 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) --===-=-= Content-Type: text/plain [ Why, oh why, did I mistype this? ] --===-=-= Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 8bit From: akater To: Stefan Monnier , 49291@gnu.org Subject: Re: [akater] [PATCH] lisp/emacs-lisp/eieio.el (initialize-instance): Fix initform Date: Wed, 30 Jun 2021 16:44:12 +0000 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" --==-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable There are iusses, some stylistic, some related to comments in the code. =2D There is a comment here: > First, see if any of our defaults are `lambda', and > re-evaluate them and apply the value to our slots.=20=20=20=20=20=20=20= =20=20=20=20=20=20 I don't observe anything like this happening. Looks like it refers to eieio-default-eval-maybe (likely referring to any compound form with fbound car as to `lambda') which used to be in eieio-core in 27 but now is gone. Maybe we should drop this comment? =2D There is a comment: > For each slot, see if we need to evaluate it Slots are self-evaluating objects; I think it was meant to be =E2=80=9Cto evaluate its initform=E2=80=9D. =2D There is FIXME > FIXME: We should be able to just do (aset this (+ i ) dflt)!=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20 Local variable dflt had been removed after Emacs 27 release. The comment should likely have been gone too, or at least updated. It suggests to assign the value of initform with a low-level `aset' applied to eieio--class struct but (1) I don't understand the + i shift (2) eieio--class is not declared to be of :type vector, neither does it inherit from a struct declared to be of :type vector. I suggest to replace the comment with =E2=80=9CTODO: maybe specify eieio--class as vector and use aset here=E2=80= =9D =2D I employ when-let which requires subr-x at compile time. I can't check the build cleanly right now, only with some dirty reverts related to libseccomp issues but aside from that, this subr-x dependency doesn't break byte-compilation of eieio.el. I hope it's fine? --==-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQJLBAEBCgA1FiEEgu5SJRdnQOF34djNsr6xYbHsf0QFAmDcn2QXHG51Y2xlYXJz cGFjZUBnbWFpbC5jb20ACgkQsr6xYbHsf0SFnhAAoVxBjRNJGYceIHZFEHFOBfuU oqVGCIZ+yBtpFZJFM4s+NBXm3M7yKTy24z2LCQUko/R8CsJ28jKPIjpWrpPnC6io SVcDaXJOt92BwFFdskYiY0Rog5FA/bqXU+ue0oy9WPOc/YgvUDcUz4kp95ZXE2q/ YiWQuOeNNY8pQ7cXCXZ/T2HufR/F4m4kyiQE4EcJ94PgF9yi9ETszB7mKuHG3tue 4hANEnx7Vh2qySHl6j4ncz/KosFyscuIrndQOi5+omGMGA94iF7xDVjDWMKNRT+9 //+mtvd9RzQmSdL5aZkM2R+5x3g9xr9ZBtWWCad8dZiVXhgkJE9AaGy9Pus3lyPf foWKOET9cOxAr7iT67V8+8OEp9UGfFIIOVFQyh8vPzRCIUXonwM1olhVGnk90IZj zC/g1oNX4uR5Avx/7PJ2S67u9eeTG0fzHRYogaPUzy3eeeWUDPFV3ri4fPVMAUyq ZXpEIeiYFpt2JE0VHrYf+TtT8zEgD/ojFiq+Lr5TGF5bhSUP6zuw0HFGT65ghOQk Ji6ywOvZLL7mz6GMC6wzxM9xvptyOzHQmGh9kfZUIn1USUiqGAQL3DEPeEa9ZOTY 5wE1rGNcZQRm+JhYfUfXW96vFMa6YWfGP2jfBAnZ5vIQyJ3gHCu2ju++/N5f/rML zX2rFA/s7rijfeH6hjE= =aNsW -----END PGP SIGNATURE----- --==-=-=-- --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-lisp-emacs-lisp-eieio.el-initialize-instance-Fix-eva.patch Content-Description: Fix eval initform >From 588e7ff1b34ccfbc9e3cb97d06ae3315487d42c9 Mon Sep 17 00:00:00 2001 From: akater Date: Wed, 30 Jun 2021 11:43:23 +0000 Subject: [PATCH] lisp/emacs-lisp/eieio.el (initialize-instance): Fix eval initform: Do not evaluate initform of a slot when initarg for the slot is provided. According to the following secitons of CLHS: - Object Creation and Initialization - Initialization Arguments - Defaulting of Initialization Arguments - Rules for Initialization Arguments --- lisp/emacs-lisp/eieio.el | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/lisp/emacs-lisp/eieio.el b/lisp/emacs-lisp/eieio.el index 1c8c372aae..ec05a07307 100644 --- a/lisp/emacs-lisp/eieio.el +++ b/lisp/emacs-lisp/eieio.el @@ -53,6 +53,7 @@ defun eieio-version () (message eieio-version)) (require 'eieio-core) +(eval-when-compile (require 'subr-x)) ;;; Defining a new class @@ -740,7 +741,7 @@ defclass eieio-default-superclass nil "Construct the new object THIS based on SLOTS.") (cl-defmethod initialize-instance ((this eieio-default-superclass) - &optional slots) + &optional slots) "Construct the new object THIS based on SLOTS. SLOTS is a tagged list where odd numbered elements are tags, and even numbered elements are the values to store in the tagged slot. @@ -749,20 +750,25 @@ defclass eieio-default-superclass nil to have this constructor called automatically. If these steps are not taken, then new objects of your class will not have their values dynamically set from SLOTS." - ;; First, see if any of our defaults are `lambda', and - ;; re-evaluate them and apply the value to our slots. (let* ((this-class (eieio--object-class this)) + (initargs slots) (slots (eieio--class-slots this-class))) (dotimes (i (length slots)) - ;; For each slot, see if we need to evaluate it. + ;; For each slot, see if we need to evaluate its initform. (let* ((slot (aref slots i)) + (slot-name (eieio-slot-descriptor-name slot)) (initform (cl--slot-descriptor-initform slot))) - ;; Those slots whose initform is constant already have the right - ;; value set in the default-object. - (unless (macroexp-const-p initform) - ;; FIXME: We should be able to just do (aset this (+ i ) dflt)! - (eieio-oset this (cl--slot-descriptor-name slot) - (eval initform t)))))) + (unless (or (eq eieio--unbound initform) + (when-let ((initarg + (car (rassq slot-name + (eieio--class-initarg-tuples + this-class))))) + (plist-get initargs initarg)) + ;; Those slots whose initform is constant already have + ;; the right value set in the default-object. + (macroexp-const-p initform)) + ;; TODO: Maybe specify eieio--class as vector explicitly and use aset + (eieio-oset this slot-name (eval initform t)))))) ;; Shared initialize will parse our slots for us. (shared-initialize this slots)) -- 2.31.1 --=-=-=-- --===-=-=-- From unknown Sat Aug 16 14:30:33 2025 X-Loop: help-debbugs@gnu.org Subject: bug#49291: [akater] [PATCH] lisp/emacs-lisp/eieio.el (initialize-instance): Fix initform Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 30 Jun 2021 19:14:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 49291 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: akater Cc: 49291@debbugs.gnu.org Received: via spool by 49291-submit@debbugs.gnu.org id=B49291.16250804299856 (code B ref 49291); Wed, 30 Jun 2021 19:14:01 +0000 Received: (at 49291) by debbugs.gnu.org; 30 Jun 2021 19:13:49 +0000 Received: from localhost ([127.0.0.1]:58740 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lyfef-0002Yu-45 for submit@debbugs.gnu.org; Wed, 30 Jun 2021 15:13:49 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:60073) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lyfeb-0002Yf-SW for 49291@debbugs.gnu.org; Wed, 30 Jun 2021 15:13:47 -0400 Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id E89C280A5C; Wed, 30 Jun 2021 15:13:39 -0400 (EDT) Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 9C78B80A7A; Wed, 30 Jun 2021 15:13:38 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1625080418; bh=CRaBLSvMIB2/YU6ZK36ENh7MhzLfjwP8/p4OVNEAfws=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=jufz1qS004l49VoiEJHGanSey3e6y9ZRryGocSx1Kkote22eC7KsoYt5oVarnE2g4 w24V5u1+zN6Ys/Vj8Ap0BJd8dx12jXyzbBIWHEhx8aHFitM4H5vcks4LToTpXhmLlC PY1rQ46VDVd1jgD4pzunWTYDatb40qxYpR2Nxb7UUNu5JOmvMMUF9GKhcMo9ONB9bc ZAzOUTICPtdn0IjNU0v5UTos6WwJ1o0rCEA9ACRzX6yWFgxqSZFnNW9xMEYo8cz5t1 SYpbUr0I48SL7YhJkFaNG21RIIo/mnh8Lf4ydkjHMqZaKj9K64s2wyE989iK9MDX/3 FQoKs5tRsCgaA== Received: from alfajor (unknown [45.72.205.238]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 66902120623; Wed, 30 Jun 2021 15:13:38 -0400 (EDT) From: Stefan Monnier Message-ID: References: <875yxvuwtf.fsf@gmail.com> Date: Wed, 30 Jun 2021 15:13:37 -0400 In-Reply-To: <875yxvuwtf.fsf@gmail.com> (akater's message of "Wed, 30 Jun 2021 16:44:12 +0000") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL -0.070 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > There are iusses, some stylistic, some related to comments in the code. > - There is a comment here: >> First, see if any of our defaults are `lambda', and >> re-evaluate them and apply the value to our slots. > I don't observe anything like this happening. Looks like it refers to > eieio-default-eval-maybe (likely referring to any compound form with > fbound car as to `lambda') which used to be in eieio-core in 27 but now > is gone. I think it's called `eieio--eval-default-p` nowadays. > Maybe we should drop this comment? Indeed, thanks. `eieio--eval-default-p` is not used here any more (it's only used in `defclass` (and its corresponding function) nowadays). > - There is a comment: >> For each slot, see if we need to evaluate it > Slots are self-evaluating objects; I think it was meant to be =E2=80=9Cto > evaluate its initform=E2=80=9D. LGTM, thanks. > - There is FIXME >> FIXME: We should be able to just do (aset this (+ i ) dflt)! > Local variable dflt had been removed after Emacs 27 release. The > comment should likely have been gone too, or at least updated. It > suggests to assign the value of initform with a low-level `aset' applied > to eieio--class struct No, not to the eieio--class but to the new object. Basically replacing the `eieio-oset` with `aset`. This is because the vector returned by `eieio--class-slots` should contain the slots info in the same order as the slots themselves are found in the actual object so we don't need to ask `eieio-set` to find the slots's position in the object. > - I employ when-let which requires subr-x at compile time. I can't > check the build cleanly right now, only with some dirty reverts related > to libseccomp issues but aside from that, this subr-x dependency doesn't > break byte-compilation of eieio.el. I hope it's fine? That Looks fine, thanks. But could you add a test or two to test/lisp/emacs-lisp/eieio-tests/eieio-tests.el ? Stefan From unknown Sat Aug 16 14:30:33 2025 X-Loop: help-debbugs@gnu.org Subject: bug#49291: [akater] [PATCH] lisp/emacs-lisp/eieio.el (initialize-instance): Fix initform Resent-From: akater Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 01 Jul 2021 12:06:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 49291 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Stefan Monnier Cc: 49291@debbugs.gnu.org Received: via spool by 49291-submit@debbugs.gnu.org id=B49291.162514113921761 (code B ref 49291); Thu, 01 Jul 2021 12:06:01 +0000 Received: (at 49291) by debbugs.gnu.org; 1 Jul 2021 12:05:39 +0000 Received: from localhost ([127.0.0.1]:59831 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lyvRq-0005eu-DR for submit@debbugs.gnu.org; Thu, 01 Jul 2021 08:05:39 -0400 Received: from mail-ej1-f43.google.com ([209.85.218.43]:38564) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lyvRo-0005ef-3P for 49291@debbugs.gnu.org; Thu, 01 Jul 2021 08:05:37 -0400 Received: by mail-ej1-f43.google.com with SMTP id gt10so8594653ejc.5 for <49291@debbugs.gnu.org>; Thu, 01 Jul 2021 05:05:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:in-reply-to:references:date:message-id :mime-version; bh=A0CQscczuSJHelQRl2rwjxEb7HAjAiXDkd4aT5sxIXI=; b=AXdWbjGM5oVBB/0CCGaPRCpX/gREvGp9moRRFAXPxJ0FpLMpLJ+L0VbxtexciFDY7a oSC/ZLTknHDp/wRt+sYjD0n54HyNoxz8NrmHaoT45IY9/b5cnNb3ma20dGwgs7IOTClx +OTVbM5ENacqlQzLYTTuQy2yl2o+6jCfEoz9yH6CMUSjsls+CKU5yVhTpNZO/lUmsuM4 qm6FaY0Gsl5OSexToF/owaaeO8oqFUxrLg/d7KFcMS+uEC218qohIXPv9X+y3zMAQjAH W8v4zqnRQGKxlyP6XmcsSYrG3wd1owt4+rsPS9+wyjHd+wonALEax5Eot1lQdLWwk4S3 MMIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date :message-id:mime-version; bh=A0CQscczuSJHelQRl2rwjxEb7HAjAiXDkd4aT5sxIXI=; b=o0A5RLPEqqRb5mitr9T/Mr18DUe5Gk0ZLWc659lierWbf5zPOt5HkeNzMMuapE6sFK kht38lbdoF8IOBR972m8EF3oTYN/nBEsh1sXQ2nWqqW1CykA1SfSxmidcn/9qzS3m3yy KuVgkXNPDvEU1rwDPNcm7G7MIWDp40r3GMYoXdlRzVPEfr8/U7aF97GWVyybo70NcrVw fwzfYlrW0ZGRL0whYVQW9YcI2BWWh1r1J/Wix96wLJAD+wriCgEBImR5o01acv/m6bRz 953XJNBtjoV9ah9EwnlzB/7hWR5wz+tcXUyRYDphhzEPrIcHZL4NP6DPFrhIgK6lwfvJ J7vQ== X-Gm-Message-State: AOAM531IMG7d7oklQ0lgU5yFoYpz5JxzXbteR3dEDJdRdXfsDytF1UiC 4PtWU5E9Esl11FsTzApY3+4= X-Google-Smtp-Source: ABdhPJy7uP9l53M81D8Pp5GctU+XECk/W/ISmUSLCNMV9S2x3+akeieEojD5UdDoMDe9x/Vx2S6vCQ== X-Received: by 2002:a17:906:5408:: with SMTP id q8mr17790656ejo.2.1625141130280; Thu, 01 Jul 2021 05:05:30 -0700 (PDT) Received: from localhost ([185.220.101.20]) by smtp.googlemail.com with ESMTPSA id v7sm3066263edd.4.2021.07.01.05.05.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Jul 2021 05:05:29 -0700 (PDT) From: akater In-Reply-To: References: <875yxvuwtf.fsf@gmail.com> Date: Thu, 01 Jul 2021 11:54:32 +0000 Message-ID: <87v95utfk7.fsf@gmail.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: 1.2 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: > No, not to the eieio--class but to the new object. Right, I was confused. I left the word FIXME but rephrased the comment so that we don't mention the non-existent dflt. At the moment, I'm not ready to reimplement this with aset and to ensure it would [...] Content analysis details: (1.2 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 1.2 RCVD_IN_BL_SPAMCOP_NET RBL: Received via a relay in bl.spamcop.net [Blocked - see ] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (nuclearspace[at]gmail.com) 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [209.85.218.43 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [209.85.218.43 listed in wl.mailspike.net] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.2 (/) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable > No, not to the eieio--class but to the new object. Right, I was confused. I left the word FIXME but rephrased the comment so that we don't mention the non-existent dflt. At the moment, I'm not ready to reimplement this with aset and to ensure it would not break by accident in an obscure manner. > But could you add a test or two to > test/lisp/emacs-lisp/eieio-tests/eieio-tests.el ? I added sort of exhaustive tests for initialization. A complete exhaustive test would also take :default-initargs and inheritance into account but I'd rather do this gradually. I did not run tests in Emacs 28 but they pass as is in Emacs 27. Some :initform's needed a fix (quote), some could be improved (search for =E2=80=9Csymbol-value=E2=80=9D in the patch). The necessity to quote should be expected to break some packages, maybe a lot. E.g. helm contained one unquoted such instance. I already fixed it; nothing else broke for me so far but it was easy to omit this quote. If authors get confused about initform workings, it may help to note that :initform actually expects a *form*, i.e. expression to be evaluated. The attempt to guess what to evaluate and what not was based on the wrong premise that CL does that. --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-lisp-emacs-lisp-eieio.el-initialize-instance-Fix-eva.patch Content-Description: Fix eval initform >From b581745bc80d5b9c0b83446e42f50103fccded4e Mon Sep 17 00:00:00 2001 From: akater Date: Wed, 30 Jun 2021 11:43:23 +0000 Subject: [PATCH] lisp/emacs-lisp/eieio.el (initialize-instance): Fix eval initform: Do not evaluate initform of a slot when initarg for the slot is provided. According to the following secitons of CLHS: - Object Creation and Initialization - Initialization Arguments - Defaulting of Initialization Arguments - Rules for Initialization Arguments Add corresponding tests. Replace :initform (symbol-value 'x) to :initform x everywhere. Quote all initforms explicitly where necessary. --- lisp/emacs-lisp/eieio.el | 28 ++++-- lisp/gnus/gnus-search.el | 52 +++++----- lisp/registry.el | 2 +- .../emacs-lisp/eieio-tests/eieio-tests.el | 97 ++++++++++++++++--- 4 files changed, 128 insertions(+), 51 deletions(-) diff --git a/lisp/emacs-lisp/eieio.el b/lisp/emacs-lisp/eieio.el index 1c8c372aae..76b2eab494 100644 --- a/lisp/emacs-lisp/eieio.el +++ b/lisp/emacs-lisp/eieio.el @@ -53,6 +53,7 @@ defun eieio-version () (message eieio-version)) (require 'eieio-core) +(eval-when-compile (require 'subr-x)) ;;; Defining a new class @@ -740,7 +741,7 @@ defclass eieio-default-superclass nil "Construct the new object THIS based on SLOTS.") (cl-defmethod initialize-instance ((this eieio-default-superclass) - &optional slots) + &optional slots) "Construct the new object THIS based on SLOTS. SLOTS is a tagged list where odd numbered elements are tags, and even numbered elements are the values to store in the tagged slot. @@ -749,20 +750,27 @@ defclass eieio-default-superclass nil to have this constructor called automatically. If these steps are not taken, then new objects of your class will not have their values dynamically set from SLOTS." - ;; First, see if any of our defaults are `lambda', and - ;; re-evaluate them and apply the value to our slots. (let* ((this-class (eieio--object-class this)) + (initargs slots) (slots (eieio--class-slots this-class))) (dotimes (i (length slots)) - ;; For each slot, see if we need to evaluate it. + ;; For each slot, see if we need to evaluate its initform. (let* ((slot (aref slots i)) + (slot-name (eieio-slot-descriptor-name slot)) (initform (cl--slot-descriptor-initform slot))) - ;; Those slots whose initform is constant already have the right - ;; value set in the default-object. - (unless (macroexp-const-p initform) - ;; FIXME: We should be able to just do (aset this (+ i ) dflt)! - (eieio-oset this (cl--slot-descriptor-name slot) - (eval initform t)))))) + (unless (or (eq eieio--unbound initform) + (when-let ((initarg + (car (rassq slot-name + (eieio--class-initarg-tuples + this-class))))) + (plist-get initargs initarg)) + ;; Those slots whose initform is constant already have + ;; the right value set in the default-object. + (macroexp-const-p initform)) + ;; FIXME: Use `aset' instead of `eieio-oset', relying on that + ;; vector returned by `eieio--class-slots' + ;; should be congruent with the object itself. + (eieio-oset this slot-name (eval initform t)))))) ;; Shared initialize will parse our slots for us. (shared-initialize this slots)) diff --git a/lisp/gnus/gnus-search.el b/lisp/gnus/gnus-search.el index 70bde264c1..202d93e053 100644 --- a/lisp/gnus/gnus-search.el +++ b/lisp/gnus/gnus-search.el @@ -787,7 +787,7 @@ defclass gnus-search-imap (gnus-search-engine) This slot is set automatically by the imap server, and cannot be set manually. Currently only partially implemented.") (raw-queries-p - :initform (symbol-value 'gnus-search-imap-raw-queries-p))) + :initform gnus-search-imap-raw-queries-p)) :documentation "The base IMAP search engine, using an IMAP server's search capabilities. This backend may be subclassed to handle particular IMAP servers' @@ -841,67 +841,67 @@ defclass gnus-search-indexed (gnus-search-engine (defclass gnus-search-swish-e (gnus-search-indexed) ((index-files :init-arg :index-files - :initform (symbol-value 'gnus-search-swish-e-index-files) + :initform gnus-search-swish-e-index-files :type list) (program - :initform (symbol-value 'gnus-search-swish-e-program)) + :initform gnus-search-swish-e-program) (remove-prefix - :initform (symbol-value 'gnus-search-swish-e-remove-prefix)) + :initform gnus-search-swish-e-remove-prefix) (switches - :initform (symbol-value 'gnus-search-swish-e-switches)) + :initform gnus-search-swish-e-switches) (raw-queries-p - :initform (symbol-value 'gnus-search-swish-e-raw-queries-p)))) + :initform gnus-search-swish-e-raw-queries-p))) (defclass gnus-search-swish++ (gnus-search-indexed) ((program - :initform (symbol-value 'gnus-search-swish++-program)) + :initform gnus-search-swish++-program) (remove-prefix - :initform (symbol-value 'gnus-search-swish++-remove-prefix)) + :initform gnus-search-swish++-remove-prefix) (switches - :initform (symbol-value 'gnus-search-swish++-switches)) + :initform gnus-search-swish++-switches) (config-file - :initform (symbol-value 'gnus-search-swish++-config-file)) + :initform gnus-search-swish++-config-file) (raw-queries-p - :initform (symbol-value 'gnus-search-swish++-raw-queries-p)))) + :initform gnus-search-swish++-raw-queries-p))) (defclass gnus-search-mairix (gnus-search-indexed) ((program - :initform (symbol-value 'gnus-search-mairix-program)) + :initform gnus-search-mairix-program) (remove-prefix - :initform (symbol-value 'gnus-search-mairix-remove-prefix)) + :initform gnus-search-mairix-remove-prefix) (switches - :initform (symbol-value 'gnus-search-mairix-switches)) + :initform gnus-search-mairix-switches) (config-file - :initform (symbol-value 'gnus-search-mairix-config-file)) + :initform gnus-search-mairix-config-file) (raw-queries-p - :initform (symbol-value 'gnus-search-mairix-raw-queries-p)))) + :initform gnus-search-mairix-raw-queries-p))) (defclass gnus-search-namazu (gnus-search-indexed) ((index-directory :initarg :index-directory - :initform (symbol-value 'gnus-search-namazu-index-directory) + :initform gnus-search-namazu-index-directory :type string :custom directory) (program - :initform (symbol-value 'gnus-search-namazu-program)) + :initform gnus-search-namazu-program) (remove-prefix - :initform (symbol-value 'gnus-search-namazu-remove-prefix)) + :initform gnus-search-namazu-remove-prefix) (switches - :initform (symbol-value 'gnus-search-namazu-switches)) + :initform gnus-search-namazu-switches) (raw-queries-p - :initform (symbol-value 'gnus-search-namazu-raw-queries-p)))) + :initform gnus-search-namazu-raw-queries-p))) (defclass gnus-search-notmuch (gnus-search-indexed) ((program - :initform (symbol-value 'gnus-search-notmuch-program)) + :initform gnus-search-notmuch-program) (remove-prefix - :initform (symbol-value 'gnus-search-notmuch-remove-prefix)) + :initform gnus-search-notmuch-remove-prefix) (switches - :initform (symbol-value 'gnus-search-notmuch-switches)) + :initform gnus-search-notmuch-switches) (config-file - :initform (symbol-value 'gnus-search-notmuch-config-file)) + :initform gnus-search-notmuch-config-file) (raw-queries-p - :initform (symbol-value 'gnus-search-notmuch-raw-queries-p)))) + :initform gnus-search-notmuch-raw-queries-p))) (define-obsolete-variable-alias 'nnir-method-default-engines 'gnus-search-default-engines "28.1") diff --git a/lisp/registry.el b/lisp/registry.el index 258f7fc904..e0aa9d1728 100644 --- a/lisp/registry.el +++ b/lisp/registry.el @@ -102,7 +102,7 @@ defclass registry-db (eieio-persistent) ;; value rather than an expression, so in order to get the value ;; of `most-positive-fixnum', we need to use an ;; expression that's not just a symbol. - :initform (symbol-value 'most-positive-fixnum) + :initform most-positive-fixnum :type integer :custom integer :documentation "The maximum number of registry entries.") diff --git a/test/lisp/emacs-lisp/eieio-tests/eieio-tests.el b/test/lisp/emacs-lisp/eieio-tests/eieio-tests.el index 11ffc115f7..e6df66a723 100644 --- a/test/lisp/emacs-lisp/eieio-tests/eieio-tests.el +++ b/test/lisp/emacs-lisp/eieio-tests/eieio-tests.el @@ -30,15 +30,16 @@ (require 'eieio-opt) (eval-when-compile (require 'cl-lib)) +(eval-when-compile (require 'cl-macs)) ;;; Code: ;; Set up some test classes (defclass class-a () ((water :initarg :water - :initform h20 + :initform 'h20 :type symbol :documentation "Detail about water.") - (classslot :initform penguin + (classslot :initform 'penguin :type symbol :documentation "A class allocated slot." :allocation :class) @@ -63,7 +64,7 @@ defclass class-ab (class-a class-b) (defclass class-c () ((slot-1 :initarg :moose - :initform moose + :initform 'moose :type symbol :allocation :instance :documentation "First slot testing slot arguments." @@ -82,7 +83,7 @@ defclass class-c () :accessor get-slot-2 :protection :private) (slot-3 :initarg :emu - :initform emu + :initform 'emu :type symbol :allocation :class :documentation "Third slot test class allocated accessor" @@ -489,9 +490,9 @@ defvar eitest-pvinit nil) (defclass inittest nil ((staticval :initform 1) - (symval :initform eieio-test-permuting-value) - (evalval :initform (symbol-value 'eieio-test-permuting-value)) - (evalnow :initform (symbol-value 'eieio-test-permuting-value) + (symval :initform 'eieio-test-permuting-value) + (evalval :initform eieio-test-permuting-value) + (evalnow :initform eieio-test-permuting-value :allocation :class) ) "Test initforms that eval.") @@ -555,6 +556,15 @@ defclass eitest-superior nil (should-not (cl-typep listooa '(list-of class-b))) (should-not (cl-typep listoob '(list-of class-a))))) +(defclass eieio-tests-initargs-initform-interplay () + ((slot-with-initarg-and-initform + :initarg :slot-with-initarg-and-initform + :initform 'value-specified-in-defclass-form) + (slot-with-initarg-only + :initarg :slot-with-initarg-only) + (slot-with-initform-only + :initform 'value-specified-in-defclass-form))) + (defvar eitest-t1 nil) (ert-deftest eieio-test-25-slot-tests () (setq eitest-t1 (class-c)) @@ -574,7 +584,66 @@ defvar eitest-t1 nil) (setf (get-slot-3 eitest-t1) 'setf-emu) (should (eq (get-slot-3 eitest-t1) 'setf-emu)) ;; Roll back - (setf (get-slot-3 eitest-t1) 'emu)) + (setf (get-slot-3 eitest-t1) 'emu) + ;; Slot initialization according to initargs and initforms + (cl-macrolet + ((when-initargs (slots &rest noerrorp + &key + slot-with-initarg-and-initform + slot-with-initarg-only + slot-with-initform-only) + (cl-macrolet ((code-for + (arg) + `(let ((slot ,arg)) + (cl-case slot + (unbound `(not (slot-boundp eitest-t1 ',',arg))) + (nil) + (t `(eq ,slot (oref eitest-t1 ,',arg))))))) + (let ((make-instance + `(setq eitest-t1 + (make-instance + 'eieio-tests-initargs-initform-interplay + ,@(cl-loop + for initarg in slots + collect initarg + collect + ''value-specified-in-make-instance-form))))) + (if noerrorp + `(progn + ,make-instance + (should `(and ,',(code-for slot-with-initarg-and-initform) + ,',(code-for slot-with-initarg-only) + ,',(code-for slot-with-initform-only)))) + `(should-error ,make-instance)))))) + ;; Whenever slot without initarg is initialized, it's an error; + ;; see CLHS, 7.1.2 Declaring the Validity of Initialization Arguments. + ;; So, the following four should just error: + (when-initargs (:slot-with-initform-only)) + (when-initargs (:slot-with-initform-only :slot-with-initarg-and-initform)) + (when-initargs (:slot-with-initform-only :slot-with-initarg-only)) + (when-initargs (:slot-with-initform-only :slot-with-initarg-and-initform + :slot-with-initarg-only)) + ;; The rest should not. + + (when-initargs (:slot-with-initarg-and-initform :slot-with-initarg-only) + :slot-with-initarg-and-initform 'value-specified-in-make-instance-form + :slot-with-initarg-only 'value-specified-in-make-instance-form + :slot-with-initform-only 'value-specified-in-defclass-form) + + (when-initargs (:slot-with-initarg-and-initform) + :slot-with-initarg-and-initform 'value-specified-in-make-instance-form + :slot-with-initarg-only unbound + :slot-with-initform-only 'value-specified-in-defclass-form) + + (when-initargs (:slot-with-initarg-only) + :slot-with-initarg-and-initform 'value-specified-in-defclass-form + :slot-with-initarg-only 'value-specified-in-make-instance-form + :slot-with-initform-only 'value-specified-in-defclass-form) + + (when-initargs () + :slot-with-initarg-and-initform 'value-specified-in-defclass-form + :slot-with-initarg-only unbound + :slot-with-initform-only 'value-specified-in-defclass-form))) (defvar eitest-t2 nil) (ert-deftest eieio-test-26-default-inheritance () @@ -696,7 +765,7 @@ defvar eitest-II3 nil) (setq eitest-II3 (clone eitest-II2 "eitest-II3 Test.")) (oset eitest-II3 slot3 'penguin) - ;; Test that slots are non-initialized slots are unbounded + ;; Test that non-initialized slots are unbounded (oref eitest-II2 slot1) (should (slot-boundp eitest-II2 'slot1)) (should-not (slot-boundp eitest-II2 'slot2)) @@ -715,7 +784,7 @@ defvar eitest-II3 nil) (should (eq (oref eitest-II3 slot3) 'penguin))) (defclass slotattr-base () - ((initform :initform init) + ((initform :initform 'init) (type :type list) (initarg :initarg :initarg) (protection :protection :private) @@ -730,7 +799,7 @@ defclass slotattr-base () Subclasses to override slot attributes.") (defclass slotattr-ok (slotattr-base) - ((initform :initform no-init) + ((initform :initform 'no-init) (initarg :initarg :initblarg) (custom :custom string :label "One String" @@ -766,7 +835,7 @@ defclass slotattr-ok (slotattr-base) (defclass slotattr-class-base () ((initform :allocation :class - :initform init) + :initform 'init) (type :allocation :class :type list) (initarg :allocation :class @@ -785,7 +854,7 @@ defclass slotattr-class-base () Subclasses to override slot attributes.") (defclass slotattr-class-ok (slotattr-class-base) - ((initform :initform no-init) + ((initform :initform 'no-init) (initarg :initarg :initblarg) (custom :custom string :label "One String" @@ -847,7 +916,7 @@ defvar eitest-CLONETEST2 nil) (should (setq eitest-CLONETEST2 (clone eitest-CLONETEST1)))) (defclass IT (eieio-instance-tracker) - ((tracking-symbol :initform IT-list) + ((tracking-symbol :initform 'IT-list) (slot1 :initform 'die)) "Instance Tracker test object.") -- 2.31.1 --=-=-=-- From unknown Sat Aug 16 14:30:33 2025 X-Loop: help-debbugs@gnu.org Subject: bug#49291: [akater] [PATCH] lisp/emacs-lisp/eieio.el (initialize-instance): Fix initform Resent-From: akater Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 01 Jul 2021 12:27:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 49291 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Stefan Monnier Cc: 49291@debbugs.gnu.org Received: via spool by 49291-submit@debbugs.gnu.org id=B49291.162514241223712 (code B ref 49291); Thu, 01 Jul 2021 12:27:02 +0000 Received: (at 49291) by debbugs.gnu.org; 1 Jul 2021 12:26:52 +0000 Received: from localhost ([127.0.0.1]:59848 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lyvmO-0006AO-3T for submit@debbugs.gnu.org; Thu, 01 Jul 2021 08:26:52 -0400 Received: from mail-wm1-f45.google.com ([209.85.128.45]:36539) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lyvmM-0006AB-Qs for 49291@debbugs.gnu.org; Thu, 01 Jul 2021 08:26:51 -0400 Received: by mail-wm1-f45.google.com with SMTP id m41-20020a05600c3b29b02901dcd3733f24so6750532wms.1 for <49291@debbugs.gnu.org>; Thu, 01 Jul 2021 05:26:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:in-reply-to:references:date:message-id :mime-version; bh=LpXpgesUv8Cw4UObwXegM2q9L0aggiHY4W1niAToUTo=; b=SLVK+3ChuL3/lRa/bxMc3A/aVy/WS8lizEAlll8d9qfzsG+bmeMUxGKH708v75gVeB 9Q9k42+u0Yt66TGxkKclYjdakLbbc9A6dgq1grEXu0WJ2e1ML1GSWaLiZ4W7afz6dQK8 KLGii55IgOFjDdb1uNLpo9zT4KDnnRVro+LbqVP5stc1nvGrlzG0hMy3+xxK0UZGU4fs UfaruFvowGoocaYqgGz0tqMsHH/720euLXwJeBgNzCH2K3wLSGNWs0UQTkBJr3Hr9bR0 Lni+d0jVJltsZguyYzExT5xHuDXv7iH9MBauZYrUUlwV3KmLEEamq+AubggiVaWXRAdv 95HA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date :message-id:mime-version; bh=LpXpgesUv8Cw4UObwXegM2q9L0aggiHY4W1niAToUTo=; b=VVs8azwCEA6Zdr4YXEx0s9H2Aq1LbumVhYSIgB53hbhNIkBJc2Jp3MMikYCBk7U8wK lifWC4IwS3jbeitQG8+HYhZIvQmHpl+VxZLb/k9DfJXjnJTD8Su3aXF8Fw0bU8c+u05V UL2hMqDUEvSTsgNOVjWTbcga2v61NsHkV/F4iQy5tNZTpycwy6Q2YWLwMVDxEL03PhGe C+bdOieNBTG5FAPfqbZgFBVyaWUtjBNd1MfAP21faPtCnETB9of9nwgCtSbtkPAO2HgW 4VorKuvYkCjPIk66ClkIjgd+BqzgLBhF2XDXmKNoUmP8MvnLte/kwPucjiwJx08/ODDm WbuA== X-Gm-Message-State: AOAM531Qh5WmAFym1A7VeoAPyx3PYgVxD/Zkffe6CNn1pNTDT9SPSlXK rL/1ktKTb83nVDMaBF8WWXw0z1y873Jj8btX X-Google-Smtp-Source: ABdhPJygSTPln5j3XacNRdAfaaXJ5Za/bQTi6VpBsmUjy28ODfIgdyGODAq3awYyc6sgx/JkxeeuXA== X-Received: by 2002:a1c:f70b:: with SMTP id v11mr44641245wmh.186.1625142404890; Thu, 01 Jul 2021 05:26:44 -0700 (PDT) Received: from localhost (tor-exit-4.zbau.f3netze.de. [185.220.100.255]) by smtp.googlemail.com with ESMTPSA id b9sm29805423wrh.81.2021.07.01.05.26.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Jul 2021 05:26:44 -0700 (PDT) From: akater In-Reply-To: <87v95utfk7.fsf@gmail.com> References: <875yxvuwtf.fsf@gmail.com> <87v95utfk7.fsf@gmail.com> Date: Thu, 01 Jul 2021 12:15:47 +0000 Message-ID: <87r1giteks.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 1.2 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Note: I better improve code generation in eieio-tests to cover (hypothetical) cases where some but not all expected values are specified, or such (hypothetical) tests will always fail. I will back to [...] Content analysis details: (1.2 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 1.2 RCVD_IN_BL_SPAMCOP_NET RBL: Received via a relay in bl.spamcop.net [Blocked - see ] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (nuclearspace[at]gmail.com) 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [209.85.128.45 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [209.85.128.45 listed in wl.mailspike.net] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.2 (/) Note: I better improve code generation in eieio-tests to cover (hypothetical) cases where some but not all expected values are specified, or such (hypothetical) tests will always fail. I will back to this, in 10 hours or so, but for existing cases, it does not matter. From unknown Sat Aug 16 14:30:33 2025 X-Loop: help-debbugs@gnu.org Subject: bug#49291: [akater] [PATCH] lisp/emacs-lisp/eieio.el (initialize-instance): Fix initform Resent-From: akater Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 02 Jul 2021 07:53:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 49291 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Stefan Monnier Cc: 49291@debbugs.gnu.org Received: via spool by 49291-submit@debbugs.gnu.org id=B49291.162521235518313 (code B ref 49291); Fri, 02 Jul 2021 07:53:01 +0000 Received: (at 49291) by debbugs.gnu.org; 2 Jul 2021 07:52:35 +0000 Received: from localhost ([127.0.0.1]:34147 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lzDyU-0004lJ-S9 for submit@debbugs.gnu.org; Fri, 02 Jul 2021 03:52:35 -0400 Received: from mail-ed1-f49.google.com ([209.85.208.49]:42579) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lzDyS-0004l3-Nu for 49291@debbugs.gnu.org; Fri, 02 Jul 2021 03:52:33 -0400 Received: by mail-ed1-f49.google.com with SMTP id n25so12010701edw.9 for <49291@debbugs.gnu.org>; Fri, 02 Jul 2021 00:52:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:in-reply-to:references:date:message-id :mime-version; bh=1Ln3eKkgUZg9xnuzpgKgdFNwh8qEgIoigYXARo5OtuY=; b=lUg7n7aq3Q+1pr62TZTxvQADw4pDCytPFM88OmB/Vy8tkTt/aB0J5RyHWD8+pxFqG+ /AvXAbaY2Q2LaYBS3EFIA6EJdw/rk9kXhv9ixwZ3BPcOSjWsOZANHpGAuen/lmtd68rC f7ke+GHm43efvxxBvLrO8lkBKcFcA8UsCBVUHFWUvcoomZXfbjBOSdPyTO32yA09+q9g W3E4M5dCuizqs9i7U5MKlBgwXytySAnQ++G/9LEH9cr0knWTBrg9/kT6mjS6wEGTaYJU 33Po11ajRxoxC0/7nJvyJoaE5WkMhz0w82wnYxXJDpnvIi3m1pEGrdu2x/4rxKMLFhmA x0iA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date :message-id:mime-version; bh=1Ln3eKkgUZg9xnuzpgKgdFNwh8qEgIoigYXARo5OtuY=; b=MlkfwMWdYfTVaCR+vfuViCxPPWlP171/vZHXGw0zj6qGnG3C6xF0lW7RokROSnt066 DWYudLopMsFEZJwJ0tEVSbHkSHVwo97uyVrkreI686Vt5KFCLYQgJk9RzZ3YUU28St3+ 5zE3mDXYC6bFJaeq7G7vxF4RUbUt/6M9AJOF93Xgu2ruxlmM5I8W3FrqchzHF15/Xfnv i+gNSOYRqn1UyzjXgG6P07uoXa63DTavG7dI6IHy0r7Bn4oO+2kC5YBqUjeaY08hvfhi v2Fvm8QbzCuM7ZWpbXegmv6S8vAKPiOJM9ilh4pZG5DCvZBMqFAxRi5cJYRBaov+T4h8 va5A== X-Gm-Message-State: AOAM530sgp+A0zIRBNGKmGJ91Kxnk3fNf89HyKS0o6WjMds4Iuf4M7Gn 8ZGE1ZWvEdglCbr0bvymNvqueppZ4WCKfZpT6VI= X-Google-Smtp-Source: ABdhPJxp2dvcFPL0h3206pBK53WEQSJNLoTT5eZgg2N5ulyc+qYH9vjY++Jo+Vxymfu0gApAqwT18Q== X-Received: by 2002:a50:eb86:: with SMTP id y6mr4996486edr.111.1625212346762; Fri, 02 Jul 2021 00:52:26 -0700 (PDT) Received: from localhost ([185.220.101.143]) by smtp.googlemail.com with ESMTPSA id t6sm943736edd.3.2021.07.02.00.52.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Jul 2021 00:52:25 -0700 (PDT) From: akater In-Reply-To: References: <875yxvuwtf.fsf@gmail.com> Date: Fri, 02 Jul 2021 07:41:26 +0000 Message-ID: <8735sxmac9.fsf@gmail.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: 1.2 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: A version with correct code generation. Tests pass on 27. =?UTF-8?Q?=E2=80=9Cwhen-initargs=E2=80=9D?= is not a perfect name but it's not a global macro, and the name is short enough to allow two descriptive initargs to fit into 80 chars width so I decided not to spend time seeking [...] Content analysis details: (1.2 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 1.2 RCVD_IN_BL_SPAMCOP_NET RBL: Received via a relay in bl.spamcop.net [Blocked - see ] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (nuclearspace[at]gmail.com) 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [209.85.208.49 listed in wl.mailspike.net] -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [209.85.208.49 listed in list.dnswl.org] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.2 (/) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable A version with correct code generation. Tests pass on 27. =E2=80=9Cwhen-initargs=E2=80=9D is not a perfect name but it's not a global= macro, and the name is short enough to allow two descriptive initargs to fit into 80 chars width so I decided not to spend time seeking for alternatives. --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-lisp-emacs-lisp-eieio.el-initialize-instance-Fix-eva.patch Content-Description: Fix eval initform >From 43288c414f00018b9f79c43e9e1232af41d4e1f5 Mon Sep 17 00:00:00 2001 From: akater Date: Wed, 30 Jun 2021 11:43:23 +0000 Subject: [PATCH] lisp/emacs-lisp/eieio.el (initialize-instance): Fix eval initform: Do not evaluate initform of a slot when initarg for the slot is provided. According to the following secitons of CLHS: - Object Creation and Initialization - Initialization Arguments - Defaulting of Initialization Arguments - Rules for Initialization Arguments Add corresponding tests. Replace :initform (symbol-value 'x) to :initform x everywhere. Quote all initforms explicitly where necessary. --- lisp/emacs-lisp/eieio.el | 28 +++-- lisp/gnus/gnus-search.el | 52 ++++----- lisp/registry.el | 2 +- .../emacs-lisp/eieio-tests/eieio-tests.el | 101 +++++++++++++++--- 4 files changed, 132 insertions(+), 51 deletions(-) diff --git a/lisp/emacs-lisp/eieio.el b/lisp/emacs-lisp/eieio.el index 1c8c372aae..76b2eab494 100644 --- a/lisp/emacs-lisp/eieio.el +++ b/lisp/emacs-lisp/eieio.el @@ -53,6 +53,7 @@ defun eieio-version () (message eieio-version)) (require 'eieio-core) +(eval-when-compile (require 'subr-x)) ;;; Defining a new class @@ -740,7 +741,7 @@ defclass eieio-default-superclass nil "Construct the new object THIS based on SLOTS.") (cl-defmethod initialize-instance ((this eieio-default-superclass) - &optional slots) + &optional slots) "Construct the new object THIS based on SLOTS. SLOTS is a tagged list where odd numbered elements are tags, and even numbered elements are the values to store in the tagged slot. @@ -749,20 +750,27 @@ defclass eieio-default-superclass nil to have this constructor called automatically. If these steps are not taken, then new objects of your class will not have their values dynamically set from SLOTS." - ;; First, see if any of our defaults are `lambda', and - ;; re-evaluate them and apply the value to our slots. (let* ((this-class (eieio--object-class this)) + (initargs slots) (slots (eieio--class-slots this-class))) (dotimes (i (length slots)) - ;; For each slot, see if we need to evaluate it. + ;; For each slot, see if we need to evaluate its initform. (let* ((slot (aref slots i)) + (slot-name (eieio-slot-descriptor-name slot)) (initform (cl--slot-descriptor-initform slot))) - ;; Those slots whose initform is constant already have the right - ;; value set in the default-object. - (unless (macroexp-const-p initform) - ;; FIXME: We should be able to just do (aset this (+ i ) dflt)! - (eieio-oset this (cl--slot-descriptor-name slot) - (eval initform t)))))) + (unless (or (eq eieio--unbound initform) + (when-let ((initarg + (car (rassq slot-name + (eieio--class-initarg-tuples + this-class))))) + (plist-get initargs initarg)) + ;; Those slots whose initform is constant already have + ;; the right value set in the default-object. + (macroexp-const-p initform)) + ;; FIXME: Use `aset' instead of `eieio-oset', relying on that + ;; vector returned by `eieio--class-slots' + ;; should be congruent with the object itself. + (eieio-oset this slot-name (eval initform t)))))) ;; Shared initialize will parse our slots for us. (shared-initialize this slots)) diff --git a/lisp/gnus/gnus-search.el b/lisp/gnus/gnus-search.el index 70bde264c1..202d93e053 100644 --- a/lisp/gnus/gnus-search.el +++ b/lisp/gnus/gnus-search.el @@ -787,7 +787,7 @@ defclass gnus-search-imap (gnus-search-engine) This slot is set automatically by the imap server, and cannot be set manually. Currently only partially implemented.") (raw-queries-p - :initform (symbol-value 'gnus-search-imap-raw-queries-p))) + :initform gnus-search-imap-raw-queries-p)) :documentation "The base IMAP search engine, using an IMAP server's search capabilities. This backend may be subclassed to handle particular IMAP servers' @@ -841,67 +841,67 @@ defclass gnus-search-indexed (gnus-search-engine (defclass gnus-search-swish-e (gnus-search-indexed) ((index-files :init-arg :index-files - :initform (symbol-value 'gnus-search-swish-e-index-files) + :initform gnus-search-swish-e-index-files :type list) (program - :initform (symbol-value 'gnus-search-swish-e-program)) + :initform gnus-search-swish-e-program) (remove-prefix - :initform (symbol-value 'gnus-search-swish-e-remove-prefix)) + :initform gnus-search-swish-e-remove-prefix) (switches - :initform (symbol-value 'gnus-search-swish-e-switches)) + :initform gnus-search-swish-e-switches) (raw-queries-p - :initform (symbol-value 'gnus-search-swish-e-raw-queries-p)))) + :initform gnus-search-swish-e-raw-queries-p))) (defclass gnus-search-swish++ (gnus-search-indexed) ((program - :initform (symbol-value 'gnus-search-swish++-program)) + :initform gnus-search-swish++-program) (remove-prefix - :initform (symbol-value 'gnus-search-swish++-remove-prefix)) + :initform gnus-search-swish++-remove-prefix) (switches - :initform (symbol-value 'gnus-search-swish++-switches)) + :initform gnus-search-swish++-switches) (config-file - :initform (symbol-value 'gnus-search-swish++-config-file)) + :initform gnus-search-swish++-config-file) (raw-queries-p - :initform (symbol-value 'gnus-search-swish++-raw-queries-p)))) + :initform gnus-search-swish++-raw-queries-p))) (defclass gnus-search-mairix (gnus-search-indexed) ((program - :initform (symbol-value 'gnus-search-mairix-program)) + :initform gnus-search-mairix-program) (remove-prefix - :initform (symbol-value 'gnus-search-mairix-remove-prefix)) + :initform gnus-search-mairix-remove-prefix) (switches - :initform (symbol-value 'gnus-search-mairix-switches)) + :initform gnus-search-mairix-switches) (config-file - :initform (symbol-value 'gnus-search-mairix-config-file)) + :initform gnus-search-mairix-config-file) (raw-queries-p - :initform (symbol-value 'gnus-search-mairix-raw-queries-p)))) + :initform gnus-search-mairix-raw-queries-p))) (defclass gnus-search-namazu (gnus-search-indexed) ((index-directory :initarg :index-directory - :initform (symbol-value 'gnus-search-namazu-index-directory) + :initform gnus-search-namazu-index-directory :type string :custom directory) (program - :initform (symbol-value 'gnus-search-namazu-program)) + :initform gnus-search-namazu-program) (remove-prefix - :initform (symbol-value 'gnus-search-namazu-remove-prefix)) + :initform gnus-search-namazu-remove-prefix) (switches - :initform (symbol-value 'gnus-search-namazu-switches)) + :initform gnus-search-namazu-switches) (raw-queries-p - :initform (symbol-value 'gnus-search-namazu-raw-queries-p)))) + :initform gnus-search-namazu-raw-queries-p))) (defclass gnus-search-notmuch (gnus-search-indexed) ((program - :initform (symbol-value 'gnus-search-notmuch-program)) + :initform gnus-search-notmuch-program) (remove-prefix - :initform (symbol-value 'gnus-search-notmuch-remove-prefix)) + :initform gnus-search-notmuch-remove-prefix) (switches - :initform (symbol-value 'gnus-search-notmuch-switches)) + :initform gnus-search-notmuch-switches) (config-file - :initform (symbol-value 'gnus-search-notmuch-config-file)) + :initform gnus-search-notmuch-config-file) (raw-queries-p - :initform (symbol-value 'gnus-search-notmuch-raw-queries-p)))) + :initform gnus-search-notmuch-raw-queries-p))) (define-obsolete-variable-alias 'nnir-method-default-engines 'gnus-search-default-engines "28.1") diff --git a/lisp/registry.el b/lisp/registry.el index 258f7fc904..e0aa9d1728 100644 --- a/lisp/registry.el +++ b/lisp/registry.el @@ -102,7 +102,7 @@ defclass registry-db (eieio-persistent) ;; value rather than an expression, so in order to get the value ;; of `most-positive-fixnum', we need to use an ;; expression that's not just a symbol. - :initform (symbol-value 'most-positive-fixnum) + :initform most-positive-fixnum :type integer :custom integer :documentation "The maximum number of registry entries.") diff --git a/test/lisp/emacs-lisp/eieio-tests/eieio-tests.el b/test/lisp/emacs-lisp/eieio-tests/eieio-tests.el index 11ffc115f7..723d67ab5f 100644 --- a/test/lisp/emacs-lisp/eieio-tests/eieio-tests.el +++ b/test/lisp/emacs-lisp/eieio-tests/eieio-tests.el @@ -30,15 +30,16 @@ (require 'eieio-opt) (eval-when-compile (require 'cl-lib)) +(eval-when-compile (require 'cl-macs)) ;;; Code: ;; Set up some test classes (defclass class-a () ((water :initarg :water - :initform h20 + :initform 'h20 :type symbol :documentation "Detail about water.") - (classslot :initform penguin + (classslot :initform 'penguin :type symbol :documentation "A class allocated slot." :allocation :class) @@ -63,7 +64,7 @@ defclass class-ab (class-a class-b) (defclass class-c () ((slot-1 :initarg :moose - :initform moose + :initform 'moose :type symbol :allocation :instance :documentation "First slot testing slot arguments." @@ -82,7 +83,7 @@ defclass class-c () :accessor get-slot-2 :protection :private) (slot-3 :initarg :emu - :initform emu + :initform 'emu :type symbol :allocation :class :documentation "Third slot test class allocated accessor" @@ -489,9 +490,9 @@ defvar eitest-pvinit nil) (defclass inittest nil ((staticval :initform 1) - (symval :initform eieio-test-permuting-value) - (evalval :initform (symbol-value 'eieio-test-permuting-value)) - (evalnow :initform (symbol-value 'eieio-test-permuting-value) + (symval :initform 'eieio-test-permuting-value) + (evalval :initform eieio-test-permuting-value) + (evalnow :initform eieio-test-permuting-value :allocation :class) ) "Test initforms that eval.") @@ -555,6 +556,15 @@ defclass eitest-superior nil (should-not (cl-typep listooa '(list-of class-b))) (should-not (cl-typep listoob '(list-of class-a))))) +(defclass eieio-tests-initargs-initform-interplay () + ((slot-with-initarg-and-initform + :initarg :slot-with-initarg-and-initform + :initform 'value-specified-in-defclass-form) + (slot-with-initarg-only + :initarg :slot-with-initarg-only) + (slot-with-initform-only + :initform 'value-specified-in-defclass-form))) + (defvar eitest-t1 nil) (ert-deftest eieio-test-25-slot-tests () (setq eitest-t1 (class-c)) @@ -574,7 +584,70 @@ defvar eitest-t1 nil) (setf (get-slot-3 eitest-t1) 'setf-emu) (should (eq (get-slot-3 eitest-t1) 'setf-emu)) ;; Roll back - (setf (get-slot-3 eitest-t1) 'emu)) + (setf (get-slot-3 eitest-t1) 'emu) + ;; Slot initialization according to initargs and initforms + (cl-macrolet + ((when-initargs (slots &rest noerrorp + &key + slot-with-initarg-and-initform + slot-with-initarg-only + slot-with-initform-only) + (cl-macrolet ((code-for + (arg) + `(let ((slot ,arg)) + (cl-case slot + (unbound `(not (slot-boundp eitest-t1 ',',arg))) + ((nil) + ;; it would be cleaner + ;; to introduce and check supplied-p arguments + ;; but it's not worth the added complexity + t) + (t `(eq ,slot (oref eitest-t1 ,',arg))))))) + (let ((make-instance + `(setq eitest-t1 + (make-instance + 'eieio-tests-initargs-initform-interplay + ,@(cl-loop + for initarg in slots + collect initarg + collect + ''value-specified-in-make-instance-form))))) + (if noerrorp + `(progn + ,make-instance + (should (and ,(code-for slot-with-initarg-and-initform) + ,(code-for slot-with-initarg-only) + ,(code-for slot-with-initform-only)))) + `(should-error ,make-instance)))))) + ;; Whenever slot without initarg is initialized by initarg, it's an error; + ;; see CLHS, 7.1.2 Declaring the Validity of Initialization Arguments. + ;; So, the following four should just error: + (when-initargs (:slot-with-initform-only)) + (when-initargs (:slot-with-initform-only :slot-with-initarg-and-initform)) + (when-initargs (:slot-with-initform-only :slot-with-initarg-only)) + (when-initargs (:slot-with-initform-only :slot-with-initarg-and-initform + :slot-with-initarg-only)) + ;; The rest should not. + + (when-initargs (:slot-with-initarg-and-initform :slot-with-initarg-only) + :slot-with-initarg-and-initform 'value-specified-in-make-instance-form + :slot-with-initarg-only 'value-specified-in-make-instance-form + :slot-with-initform-only 'value-specified-in-defclass-form) + + (when-initargs (:slot-with-initarg-and-initform) + :slot-with-initarg-and-initform 'value-specified-in-make-instance-form + :slot-with-initarg-only unbound + :slot-with-initform-only 'value-specified-in-defclass-form) + + (when-initargs (:slot-with-initarg-only) + :slot-with-initarg-and-initform 'value-specified-in-defclass-form + :slot-with-initarg-only 'value-specified-in-make-instance-form + :slot-with-initform-only 'value-specified-in-defclass-form) + + (when-initargs () + :slot-with-initarg-and-initform 'value-specified-in-defclass-form + :slot-with-initarg-only unbound + :slot-with-initform-only 'value-specified-in-defclass-form))) (defvar eitest-t2 nil) (ert-deftest eieio-test-26-default-inheritance () @@ -696,7 +769,7 @@ defvar eitest-II3 nil) (setq eitest-II3 (clone eitest-II2 "eitest-II3 Test.")) (oset eitest-II3 slot3 'penguin) - ;; Test that slots are non-initialized slots are unbounded + ;; Test that non-initialized slots are unbounded (oref eitest-II2 slot1) (should (slot-boundp eitest-II2 'slot1)) (should-not (slot-boundp eitest-II2 'slot2)) @@ -715,7 +788,7 @@ defvar eitest-II3 nil) (should (eq (oref eitest-II3 slot3) 'penguin))) (defclass slotattr-base () - ((initform :initform init) + ((initform :initform 'init) (type :type list) (initarg :initarg :initarg) (protection :protection :private) @@ -730,7 +803,7 @@ defclass slotattr-base () Subclasses to override slot attributes.") (defclass slotattr-ok (slotattr-base) - ((initform :initform no-init) + ((initform :initform 'no-init) (initarg :initarg :initblarg) (custom :custom string :label "One String" @@ -766,7 +839,7 @@ defclass slotattr-ok (slotattr-base) (defclass slotattr-class-base () ((initform :allocation :class - :initform init) + :initform 'init) (type :allocation :class :type list) (initarg :allocation :class @@ -785,7 +858,7 @@ defclass slotattr-class-base () Subclasses to override slot attributes.") (defclass slotattr-class-ok (slotattr-class-base) - ((initform :initform no-init) + ((initform :initform 'no-init) (initarg :initarg :initblarg) (custom :custom string :label "One String" @@ -847,7 +920,7 @@ defvar eitest-CLONETEST2 nil) (should (setq eitest-CLONETEST2 (clone eitest-CLONETEST1)))) (defclass IT (eieio-instance-tracker) - ((tracking-symbol :initform IT-list) + ((tracking-symbol :initform 'IT-list) (slot1 :initform 'die)) "Instance Tracker test object.") -- 2.31.1 --=-=-=-- From unknown Sat Aug 16 14:30:33 2025 X-Loop: help-debbugs@gnu.org Subject: bug#49291: [akater] [PATCH] lisp/emacs-lisp/eieio.el (initialize-instance): Fix initform Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 09 Jul 2021 15:01:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 49291 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: akater Cc: 49291@debbugs.gnu.org Received: via spool by 49291-submit@debbugs.gnu.org id=B49291.1625842838610 (code B ref 49291); Fri, 09 Jul 2021 15:01:02 +0000 Received: (at 49291) by debbugs.gnu.org; 9 Jul 2021 15:00:38 +0000 Received: from localhost ([127.0.0.1]:59504 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m1rza-00009m-C5 for submit@debbugs.gnu.org; Fri, 09 Jul 2021 11:00:38 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:20914) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m1rzX-00009Y-Vk for 49291@debbugs.gnu.org; Fri, 09 Jul 2021 11:00:37 -0400 Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id ED1B5440C76; Fri, 9 Jul 2021 11:00:29 -0400 (EDT) Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 93E884403A2; Fri, 9 Jul 2021 11:00:28 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1625842828; bh=BqTIh+go+U8dF/xVoiT/E5d4coRuWmgFrkih1rTvU4c=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=TvpaC2hmKV4EQYUQgd5LB/7GRZ/P/a+DSquLVBFvBvTIjGedM6PLHvTs63nc+MSvl iQkXzY37733ieCu/CtjgsSTo5ZXTVeUYJCawfpzNL4ag6jj2y/0Kjp75JZHIoKCzkK bEapgrP6FFRbL4co2PdU/wva662+lrw58fTI2bgLec0GcOcbqEio6WpdqxiFJ8XsUt ZGoFYM/B6Aj0yoLxIclHrERJtfckA5IxqySITCudy3t1TK7gCsaSUdlP9dISg33aXd bpioZFcr/AyZo5SQe91EkMCzab2dm1OxRF61dB4z8pngX3yXS4l5feZINlG8YLSKcg K7iWHtIl3mrsw== Received: from alfajor (unknown [216.154.29.138]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 48E56120328; Fri, 9 Jul 2021 11:00:28 -0400 (EDT) From: Stefan Monnier Message-ID: References: <875yxvuwtf.fsf@gmail.com> <8735sxmac9.fsf@gmail.com> Date: Fri, 09 Jul 2021 11:00:27 -0400 In-Reply-To: <8735sxmac9.fsf@gmail.com> (akater's message of "Fri, 02 Jul 2021 07:41:26 +0000") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL -0.102 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) akater [2021-07-02 07:41:26] wrote: > A version with correct code generation. Tests pass on 27. Sorry 'bout the delay. > Replace :initform (symbol-value 'x) to :initform x everywhere. This can't be right because it presumes the CLOS semantics which we don't have yet: `:initform x` will use the symbol `x` rather than the value of variable `x` as the default value (and it will emit a warning because we don't want code to rely on this non-CLOS-compatible semantics). Hopefully we'll be able to do that in a few years, but we're not there yet. > +(defclass eieio-tests-initargs-initform-interplay () > + ((slot-with-initarg-and-initform > + :initarg :slot-with-initarg-and-initform > + :initform 'value-specified-in-defclass-form) > + (slot-with-initarg-only > + :initarg :slot-with-initarg-only) > + (slot-with-initform-only > + :initform 'value-specified-in-defclass-form))) I don't understand how you can use this to test the interplay between :initargs and :initform. I thought this bug was about the fact that :iniform gets evaluated in cases where it shouldn't, not about the final value in the object. IOW it's about potential side-effects of evaluating :initform in cases where we shouldn't. But the above :initforms are all pure so I can't see how it can test what we're after. More to the point: the `eieio-test-25-slot-tests` extended as in your patch passes successfully without your changes to eieio.el, so it's not a proper regression test: we want a test that fails on the current code and succeeds after we install your patch. Another thing, in the patch you have: +(eval-when-compile (require 'cl-macs)) which is not only redundant with the (eval-when-compile (require 'cl-lib)) on the previous line, but makes assumptions about the way cl-lib is split into files: always require `cl-lib` (rather than `cl-macs`, `cl-extra`, etc...) when you need any part of it. Stefan From unknown Sat Aug 16 14:30:33 2025 X-Loop: help-debbugs@gnu.org Subject: bug#49291: [akater] [PATCH] lisp/emacs-lisp/eieio.el (initialize-instance): Fix initform Resent-From: akater Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 12 Jul 2021 18:44:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 49291 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Stefan Monnier Cc: 49291@debbugs.gnu.org Received: via spool by 49291-submit@debbugs.gnu.org id=B49291.162611540727317 (code B ref 49291); Mon, 12 Jul 2021 18:44:02 +0000 Received: (at 49291) by debbugs.gnu.org; 12 Jul 2021 18:43:27 +0000 Received: from localhost ([127.0.0.1]:38871 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m30tr-00076X-C2 for submit@debbugs.gnu.org; Mon, 12 Jul 2021 14:43:27 -0400 Received: from mail-qv1-f54.google.com ([209.85.219.54]:43795) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m30tp-00076J-If for 49291@debbugs.gnu.org; Mon, 12 Jul 2021 14:43:26 -0400 Received: by mail-qv1-f54.google.com with SMTP id i4so8560387qvq.10 for <49291@debbugs.gnu.org>; Mon, 12 Jul 2021 11:43:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:in-reply-to:references:date:message-id :mime-version; bh=nfRoSFc7PDEDqwv9Sblf5Ge7xlfksq11yCI2H1RhUP4=; b=p5e49ZqbosyQdCUD0pRuc000gjDod08X6/Z3FkGf9FkVe1EF9GJ8IzXMEc+mqqDnfH QhpEh/UuQ4SoAtA+0VKLznGPMuQFf+Fy36YEFvdlz71DqRpUzelvKPcXxdejOPP1DR0q s/jNd+evSfkAa92i/HTcfOFIQJ8a+UYusRJM5GtNUXZ4ayLPxSoC2709euR68rt2wd8h hAbVG+OoxjUGMfCDzQeH2nYcTDULzXSkf8U9aK5SKvBJVd+Tz2PHXsYfjhQVyj6Eh4fm ey1HJ8pXyObR5xgiLj5OY3D1nvsB8LFTe+YhWNSQbLtQwSum/zw+4fmBaIcH1NEyDZsS hi+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date :message-id:mime-version; bh=nfRoSFc7PDEDqwv9Sblf5Ge7xlfksq11yCI2H1RhUP4=; b=qv+ABNp+pjT/a9CIhVj9BXWA3r3l4YiRO+Q33q+K5PeZfQ+GrR5jv7lSOYpTSEG3Ve hBv4d/18fdK7zR8PGKOkNE2yVhkFmgrA42Q1VlMpxeQNYU34XpNZ97292pWbkx6FliYD l37d2sn8sseau/kVqV5KkQQk9Gn0DiXN0C+wzovbYewjZ5hiXK+k0s2VN90Bsc9qJZIV uyX7mFHvStln59kPv7f79Ag1z3nOxR/W7P+arO4UsJySzEtAZm8lGgDCAGMNoLJG5Ywb D01fB0ET4GBOW2FqtqQp7ZDTo0lAYsLo40hZVLKp8zw7wKOLb11TCWw0UBW4KJgt8Z71 2oiw== X-Gm-Message-State: AOAM530+2ktbY1Fd+m2Tit42cBMjlZrP5RvW7DTm7wJV1HpCAOAk2wZ/ pqnmio2PcYtnr+cpaWHcisDK1e/ARaY= X-Google-Smtp-Source: ABdhPJx8Aan8Iat9rbmKF0/Owsg8w9iGXen3zMJBIz0bB/G+c91AEuD7rqEn6HL2gxr+SXD0dvgHvg== X-Received: by 2002:a0c:d845:: with SMTP id i5mr402702qvj.32.1626115399877; Mon, 12 Jul 2021 11:43:19 -0700 (PDT) Received: from localhost (tor-exit-fr.letztermensch.com. [51.210.80.127]) by smtp.googlemail.com with ESMTPSA id v5sm6836441qkh.39.2021.07.12.11.43.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Jul 2021 11:43:19 -0700 (PDT) From: akater In-Reply-To: References: <875yxvuwtf.fsf@gmail.com> <8735sxmac9.fsf@gmail.com> Date: Mon, 12 Jul 2021 18:32:09 +0000 Message-ID: <87fswjcriu.fsf@gmail.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-=-= Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" --==-=-= Content-Type: text/plain Stefan Monnier writes: > This can't be right because it presumes the CLOS semantics which we > don't have yet: `:initform x` will use the symbol `x` rather than the > value of variable `x` as the default value (and it will emit a warning > because we don't want code to rely on this non-CLOS-compatible > semantics). Right. I had to do it in Emacs 27 but it's implemented differently in 28, as should have been evident to me given the current code in initialize-instance. > we want a test that fails on the current code > and succeeds after we install your patch. OK; I replaced the tests. --==-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQJLBAEBCgA1FiEEgu5SJRdnQOF34djNsr6xYbHsf0QFAmDsiqsXHG51Y2xlYXJz cGFjZUBnbWFpbC5jb20ACgkQsr6xYbHsf0SDdg/+LrZyRuLd8wmncRaKHwc0JTfI H9v7BkFou8yuLRSMso/VRvDis2CMD0Iy59S5l9avDE9mRhmdJaZMgyaMra0YIWIA JtqxgVuDbTZQArfAKFdrpze9Pf3NDV7RwuULWmCGcDpiyFGsR6XULtSsiKJ7ZYuL mQUgn1sgThiF8XsRWWNKWUCexxtjFhmuDKknyJ8wxAtna7mw3gVMOgcxxdpebtCO sfHgq9yPqSoQOOw7nL7i3JDDXyyYU5ExrNcR3FwgueR54Yeni82Hfozxii4EKe2E DQa+D6jL6l1WG4P9NJgmJ4QeU7dgnHEMjaSbprEz7gird6MofSHrNOLatVWsWgXH cMVacp+UEWRA0TPRwJe2X1ZZF1khxm4OLceMYBSNDLwkiDrXAcZvJecJ4hJrAWeM m3qMzgFuzfPrjnCshQISUGXtxYeGIHdEsIKXg6ZffaXD78O+le1Q+fspVqoOjw4C ErlCU+z9kJVq93JDFosjaZ8yCmgjH+pac24fTv8zoo962jnhzjp25lQF2wERzgCy 1KtYMxR5JMkq9oRsGyNxm8UuJnEA4S4KUqYT8GW27WZsXjGrUnFSUvz5xB09rxKT 2omYJRGyuIRKt8GJZPOJm01lab443TR9k/R/6cI9C1RKNNvESBsN+SK79cfDKn9d skl9GYeQ2t8y3YWvFUA= =gXgS -----END PGP SIGNATURE----- --==-=-=-- --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-Prevent-excessive-evaluation-of-initform.patch Content-Description: Fix eval initform >From 75990f852a03436f84bd42f9ce22975a6b0c166a Mon Sep 17 00:00:00 2001 From: akater Date: Mon, 12 Jul 2021 14:15:54 +0000 Subject: [PATCH] Prevent excessive evaluation of :initform * lisp/emacs-lisp/eieio.el (initialize-instance): Do not evaluate initform of a slot when initarg for the slot is provided, according to the following secitons of CLHS: - Object Creation and Initialization - Initialization Arguments - Defaulting of Initialization Arguments - Rules for Initialization Arguments * test/lisp/emacs-lisp/eieio-etests/eieio-tests.el: Add corresponding tests Fix a typo --- lisp/emacs-lisp/eieio.el | 28 ++++++++++++------- .../emacs-lisp/eieio-tests/eieio-tests.el | 16 ++++++++++- 2 files changed, 33 insertions(+), 11 deletions(-) diff --git a/lisp/emacs-lisp/eieio.el b/lisp/emacs-lisp/eieio.el index 1c8c372aae..76b2eab494 100644 --- a/lisp/emacs-lisp/eieio.el +++ b/lisp/emacs-lisp/eieio.el @@ -53,6 +53,7 @@ defun eieio-version () (message eieio-version)) (require 'eieio-core) +(eval-when-compile (require 'subr-x)) ;;; Defining a new class @@ -740,7 +741,7 @@ defclass eieio-default-superclass nil "Construct the new object THIS based on SLOTS.") (cl-defmethod initialize-instance ((this eieio-default-superclass) - &optional slots) + &optional slots) "Construct the new object THIS based on SLOTS. SLOTS is a tagged list where odd numbered elements are tags, and even numbered elements are the values to store in the tagged slot. @@ -749,20 +750,27 @@ defclass eieio-default-superclass nil to have this constructor called automatically. If these steps are not taken, then new objects of your class will not have their values dynamically set from SLOTS." - ;; First, see if any of our defaults are `lambda', and - ;; re-evaluate them and apply the value to our slots. (let* ((this-class (eieio--object-class this)) + (initargs slots) (slots (eieio--class-slots this-class))) (dotimes (i (length slots)) - ;; For each slot, see if we need to evaluate it. + ;; For each slot, see if we need to evaluate its initform. (let* ((slot (aref slots i)) + (slot-name (eieio-slot-descriptor-name slot)) (initform (cl--slot-descriptor-initform slot))) - ;; Those slots whose initform is constant already have the right - ;; value set in the default-object. - (unless (macroexp-const-p initform) - ;; FIXME: We should be able to just do (aset this (+ i ) dflt)! - (eieio-oset this (cl--slot-descriptor-name slot) - (eval initform t)))))) + (unless (or (eq eieio--unbound initform) + (when-let ((initarg + (car (rassq slot-name + (eieio--class-initarg-tuples + this-class))))) + (plist-get initargs initarg)) + ;; Those slots whose initform is constant already have + ;; the right value set in the default-object. + (macroexp-const-p initform)) + ;; FIXME: Use `aset' instead of `eieio-oset', relying on that + ;; vector returned by `eieio--class-slots' + ;; should be congruent with the object itself. + (eieio-oset this slot-name (eval initform t)))))) ;; Shared initialize will parse our slots for us. (shared-initialize this slots)) diff --git a/test/lisp/emacs-lisp/eieio-tests/eieio-tests.el b/test/lisp/emacs-lisp/eieio-tests/eieio-tests.el index 11ffc115f7..3ec4234344 100644 --- a/test/lisp/emacs-lisp/eieio-tests/eieio-tests.el +++ b/test/lisp/emacs-lisp/eieio-tests/eieio-tests.el @@ -574,7 +574,21 @@ defvar eitest-t1 nil) (setf (get-slot-3 eitest-t1) 'setf-emu) (should (eq (get-slot-3 eitest-t1) 'setf-emu)) ;; Roll back - (setf (get-slot-3 eitest-t1) 'emu)) + (setf (get-slot-3 eitest-t1) 'emu) + (defvar eieio-tests-initform-was-evaluated) + (defclass eieio-tests-initform-not-evaluated-when-initarg-is-present () + ((slot-with-initarg-and-initform + :initarg :slot-with-initarg-and-initform + :initform (setf eieio-tests-initform-was-evaluated t)))) + (setq eieio-tests-initform-was-evaluated nil) + (make-instance + 'eieio-tests-initform-not-evaluated-when-initarg-is-present) + (should eieio-tests-initform-was-evaluated) + (setq eieio-tests-initform-was-evaluated nil) + (make-instance + 'eieio-tests-initform-not-evaluated-when-initarg-is-present + :slot-with-initarg-and-initform t) + (should-not eieio-tests-initform-was-evaluated)) (defvar eitest-t2 nil) (ert-deftest eieio-test-26-default-inheritance () -- 2.31.1 --=-=-=-- From unknown Sat Aug 16 14:30:33 2025 X-Loop: help-debbugs@gnu.org Subject: bug#49291: [akater] [PATCH] lisp/emacs-lisp/eieio.el (initialize-instance): Fix initform Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 16 Jul 2021 19:42:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 49291 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: akater Cc: 49291@debbugs.gnu.org Received: via spool by 49291-submit@debbugs.gnu.org id=B49291.162646448717254 (code B ref 49291); Fri, 16 Jul 2021 19:42:01 +0000 Received: (at 49291) by debbugs.gnu.org; 16 Jul 2021 19:41:27 +0000 Received: from localhost ([127.0.0.1]:52361 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m4TiB-0004UE-93 for submit@debbugs.gnu.org; Fri, 16 Jul 2021 15:41:27 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:58242) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m4Ti8-0004Ty-2v for 49291@debbugs.gnu.org; Fri, 16 Jul 2021 15:41:26 -0400 Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 406738068C; Fri, 16 Jul 2021 15:41:18 -0400 (EDT) Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 4362780668; Fri, 16 Jul 2021 15:41:17 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1626464477; bh=+T//zgywu3TFLFkOeq7iyrKhEaitRhmRyqCki9OXnY8=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=PMiKExY6knN6ejf5zLmn4+4SzPLfxNf+O9v4akQ13W2S/ir2ONzmbv0Mdz2vaa9jd scRFvPS1IHgfptfvhblMI2VwwXX/OlzkvnPE0b6bi0OsrTNgp/A1YGdLCLbwcATmmF nxx2nFJGeFdvFXMO4bB7my95qlBnYrYz5skd2CBvkdpIQN8WqKLDRF5T/iJZs6y2dq LiNP3a4tXv9iRBXtEObSRBQXU1SML6ApbOmQsZrdtIi9Ix204GtVJwg5ZACYMMzDqu VypMTgiwyCAGAFRDVyQK2puLY3qaUC24XEpz1PMPsS/NED/EHngLtVUSvn2106qSTh kJU/os1rzvqrA== Received: from alfajor (unknown [216.154.29.138]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 1915A120476; Fri, 16 Jul 2021 15:41:17 -0400 (EDT) From: Stefan Monnier Message-ID: References: <875yxvuwtf.fsf@gmail.com> <8735sxmac9.fsf@gmail.com> <87fswjcriu.fsf@gmail.com> Date: Fri, 16 Jul 2021 15:41:16 -0400 In-Reply-To: <87fswjcriu.fsf@gmail.com> (akater's message of "Mon, 12 Jul 2021 18:32:09 +0000") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL -0.094 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) >> we want a test that fails on the current code >> and succeeds after we install your patch. > OK; I replaced the tests. Thanks, pushed to `master`. Stefan From unknown Sat Aug 16 14:30:33 2025 X-Loop: help-debbugs@gnu.org Subject: bug#49291: [akater] [PATCH] lisp/emacs-lisp/eieio.el (initialize-instance): Fix initform Resent-From: Lars Ingebrigtsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 19 Jul 2021 16:07:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 49291 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Stefan Monnier Cc: 49291@debbugs.gnu.org, akater Received: via spool by 49291-submit@debbugs.gnu.org id=B49291.16267107758478 (code B ref 49291); Mon, 19 Jul 2021 16:07:02 +0000 Received: (at 49291) by debbugs.gnu.org; 19 Jul 2021 16:06:15 +0000 Received: from localhost ([127.0.0.1]:60063 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m5VmZ-0002Cg-4L for submit@debbugs.gnu.org; Mon, 19 Jul 2021 12:06:15 -0400 Received: from quimby.gnus.org ([95.216.78.240]:47068) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m5VmX-0002CQ-2u for 49291@debbugs.gnu.org; Mon, 19 Jul 2021 12:06:13 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=hJNP8NVlMyEhP5RyBMEDAK/Z/fena4FCm1TqRVDBKYM=; b=AJfIpM7eZwJaMnLIpMpk789McF 4SUuAMQsuIRbt/NrDMtXwG6nidJ5g7RJSosXDIHiisERwxs5YEhhPbozg3vuJmOugRSZ3HQMeSwlS OenvmZrGpO8HBY1TlK9sZb5SIwBizsnJ6NRfUBtgDXYEhvXlQmRgPP152Wfh21BXXYlk=; Received: from cm-84.212.220.105.getinternet.no ([84.212.220.105] helo=elva) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1m5VmO-0000BI-GX; Mon, 19 Jul 2021 18:06:06 +0200 From: Lars Ingebrigtsen References: <875yxvuwtf.fsf@gmail.com> <8735sxmac9.fsf@gmail.com> <87fswjcriu.fsf@gmail.com> X-Now-Playing: Chuck Person's _Chuck Person's Eccojams Vol. 1_: "B3" Date: Mon, 19 Jul 2021 18:06:04 +0200 In-Reply-To: (Stefan Monnier's message of "Fri, 16 Jul 2021 15:41:16 -0400") Message-ID: <87k0lmjnkj.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Stefan Monnier writes: > Thanks, pushed to `master`. And I'm closing the bug report, then. Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Stefan Monnier writes: > Thanks, pushed to `master`. And I'm closing the bug report, then. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From debbugs-submit-bounces@debbugs.gnu.org Mon Jul 19 12:06:21 2021 Received: (at control) by debbugs.gnu.org; 19 Jul 2021 16:06:21 +0000 Received: from localhost ([127.0.0.1]:60066 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m5Vmf-0002Cz-B0 for submit@debbugs.gnu.org; Mon, 19 Jul 2021 12:06:21 -0400 Received: from quimby.gnus.org ([95.216.78.240]:47084) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m5Vmc-0002CX-Ls for control@debbugs.gnu.org; Mon, 19 Jul 2021 12:06:18 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Subject:From:To:Message-Id:Date:Sender:Reply-To:Cc: MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=TgBFXQIOyGwIuDPmnOQKGJC0IKB2F75ouocWOjs9l40=; b=TdyeIhye30sRTAI7ZjiWUg6VU6 97dGEztzkhjm1KJawvB23jDTU759HiDeEp5aDya5YVZGEUHh3VPfm85unVJ5+cU2dbvWK7YSxI6iM uhufEaFh7sbYTqfg0vqlP7Dpd9mu3uh068SrTRoCnis8DQc79JgGPgmZyUeNbMV6+/lk=; Received: from cm-84.212.220.105.getinternet.no ([84.212.220.105] helo=elva) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1m5VmV-0000BQ-6n for control@debbugs.gnu.org; Mon, 19 Jul 2021 18:06:13 +0200 Date: Mon, 19 Jul 2021 18:06:10 +0200 Message-Id: <87im16jnkd.fsf@gnus.org> To: control@debbugs.gnu.org From: Lars Ingebrigtsen Subject: control message for bug #49291 X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: close 49291 28.1 quit Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) close 49291 28.1 quit