From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#66938: 30.0.50 [PATCH]: Make EIEIO :accessor behave like :reader when reading a slot's value Date: Wed, 29 Nov 2023 09:01:32 -0500 Message-ID: References: Reply-To: Stefan Monnier Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="24732"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: brandon.irizarry@gmail.com, 66938@debbugs.gnu.org, 66938-done@debbugs.gnu.org To: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Nov 29 15:03:26 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1r8L9y-0006BL-Gx for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 29 Nov 2023 15:03:26 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r8L9i-00015W-AN; Wed, 29 Nov 2023 09:03:10 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r8L9b-00010s-P1 for bug-gnu-emacs@gnu.org; Wed, 29 Nov 2023 09:03:07 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r8L9T-0004bc-Fg for bug-gnu-emacs@gnu.org; Wed, 29 Nov 2023 09:03:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1r8L9a-0001uX-V7 for bug-gnu-emacs@gnu.org; Wed, 29 Nov 2023 09:03:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 29 Nov 2023 14:03:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 66938 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 66938-done@debbugs.gnu.org id=D66938.17012665237252 (code D ref 66938); Wed, 29 Nov 2023 14:03:02 +0000 Original-Received: (at 66938-done) by debbugs.gnu.org; 29 Nov 2023 14:02:03 +0000 Original-Received: from localhost ([127.0.0.1]:49173 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r8L8c-0001st-Fk for submit@debbugs.gnu.org; Wed, 29 Nov 2023 09:02:02 -0500 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:47037) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r8L8Z-0001sB-Uh; Wed, 29 Nov 2023 09:02:00 -0500 Original-Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 997F4441352; Wed, 29 Nov 2023 09:01:46 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1701266505; bh=zBHGneXdPcV6lcn3PcYgm1jL3yFWt4KPQBEWnP16FQY=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=X8u3zYfJAp34GJwSgJfUoaFdsy6A0s2vSSVmq+ki4h7Sh41TeIzyaYnsmSOWsBQAC Fl3Jaoos3qHJ9hWJS5toYS33EJhD9LKpVUba8+1uqaXgNfHl19/10V487ffJ53TDEh gGJiy73InXGmgZ11wmJ5WfuvNu84w0puGFVIJPV9IDKIjF3YJFu3kVERv6zz+D61j3 vlU8EWI6baZmsFyLkp55XadPL5QDQS2ua5+Y3IlWTEVu2eBVVkMFuf6gH1JSZHp8nt 4+TnGL4VGX7s5uKYP3UtWWg1R2Ql2kxheMpUmxzdZMmds2q/yUoAiPVQNL78v+53QU tUL/cwyPJrxdg== Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 99E6844132E; Wed, 29 Nov 2023 09:01:45 -0500 (EST) Original-Received: from lechazo (lechon.iro.umontreal.ca [132.204.27.242]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 88CDF120153; Wed, 29 Nov 2023 09:01:45 -0500 (EST) In-Reply-To: ("=?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?="'s message of "Wed, 29 Nov 2023 00:29:31 +0000") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:275229 Archived-At: > Just wanted to say that while I think this is all very fine to > improve on EIEIO's inaccurate emulation of CLOS, this breaks > a lot of stuff, broke Eglot and Jsonrpc, immediately. > > This is mainly because EIEIO users like me got sloppy with > their slot definitions and don't put explicit :initforms > in them, instead relying on this quirk. FWIW, I don't like the `slot-boundp` business and much prefer the principle that if an application needs such a concept it should instead treat nil as the "unbound" marker. > Oh well, I'm fixing this now as part of bug#67480, but > we should definitely expect flak more or less proportional > to the use of EIEIO out there (and in here). Hmm... > BTW another reason I get sloppy is that EIEIO doesn't allow > me to use a > > (some-slot :initform (error "required!") ...) > > like I do in CLOS. I think this works nowadays (the expression is not evaluated in the right context (it's evaluated in the empty context), but AFAICT it's evaluated at the right time): (cl-defmethod initialize-instance ((this eieio-default-superclass) &optional args) [...] (let* ((slot (aref slots i)) (slot-name (eieio-slot-descriptor-name slot)) (initform (cl--slot-descriptor-initform slot))) [...] (eieio-oset this slot-name (eval initform t)))))) [...] -- Stefan