From debbugs-submit-bounces@debbugs.gnu.org Fri Feb 11 05:02:29 2022 Received: (at submit) by debbugs.gnu.org; 11 Feb 2022 10:02:29 +0000 Received: from localhost ([127.0.0.1]:58369 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nISl3-0003tn-Gg for submit@debbugs.gnu.org; Fri, 11 Feb 2022 05:02:29 -0500 Received: from lists.gnu.org ([209.51.188.17]:45546) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nISl1-0003tg-RB for submit@debbugs.gnu.org; Fri, 11 Feb 2022 05:02:28 -0500 Received: from eggs.gnu.org ([209.51.188.92]:39096) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nISl1-0004UU-KN for bug-gnu-emacs@gnu.org; Fri, 11 Feb 2022 05:02:27 -0500 Received: from mail-oln040092072074.outbound.protection.outlook.com ([40.92.72.74]:23527 helo=EUR03-VE1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nISkz-0003vd-KW for bug-gnu-emacs@gnu.org; Fri, 11 Feb 2022 05:02:27 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=J7T09W+KlGaV0qA/bmXv2HMR62NNHhTQtg0x0aKHA5a/wDQW7iXN43I9k0+7YXLLbYxv6B7nu/YSCWzRGekYtvEUG/SF3TZt81TPnPcDAJ/7vi2A1adskpgesumopWHBXh8kkuh+Iv8nmdfVW1jDtwB/TNTRidRtCEEelvrVAzXOrJb8FMJ2RqxymFjsX6uXH4UTbFWu9nMKa2Ed6mZntD0CaKP/RWPVILKp9SrWk73+ZOygoB6LDJ0JUU6pCDZFMTStJpqa9O3lQ5dNEBDNG59XcCMg3VXCnkP8LAYWxW60hWdWrqW2eJFWu1MdL/bSPQXPQqkzNJrkXu1eofzJKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ws6+2ClMgHPL3VWQcMvSf0sglo66bMgXSYk2Gmiy9WQ=; b=c80Z414qb4bBGRnioTMS8KEhvdoLwEoOToFSzgmyt/QX7p5dqcZxJKBnEsx9JCucTRU30o1aKG+bdz6nroOkgA5Of0o/OSiot0S9yh6YemWAeQXsyHCmz9pAEJIXfDNoqKGrr+HZsakzVKXySO3kthW/cPQ+DgtOGjNI9z9eH+5AUuW+tM3HcGKfSLoLlWml/h8qVy5y9kJknxNgqtu91UDglVzE2BzSoFstrB7lKE/YxOBHkm8ix4c7ZoPdrTsLSH3GLGSczGv72LoxUx5+PaU0ZAPGEPm2ZJ/pnMEIOAqF+hpCyl7CqKAxgepsfglr42unGYFuHjKJEON46LRUuw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hotmail.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ws6+2ClMgHPL3VWQcMvSf0sglo66bMgXSYk2Gmiy9WQ=; b=Ym5+0Da1Xbi4FluhUsqigwPOl05+1jUWAo9qCPZnPnYeVpSMs8VrZGunp5WL4b5R+daYwvbpa9WWcDqqd10rMC3D7KutHFM17Nn46eaH/SkIg2rJh+hnLngyCNK3a9m0G23xvhQJAfvGyCoJLLA+Uvevj1O7lnMAqMSU58ryQEehO43rU+U6qfAlW3DFX3mKdjgkOjTGVt/B/BcSPGAeWk1ZfppwcBSZOR6/lrudk/pM55cFQgO/UN8nHb3f2zrZ3g0fKP8WAE42o798jscC1dCS5jIBjeCgvLm2SCsGuBXLle0P+kVA6kauSUWvLo4Plk43Zz0LRGbaYeYWsrYitw== Received: from PAXPR06MB7760.eurprd06.prod.outlook.com (2603:10a6:102:155::8) by AM6PR06MB4390.eurprd06.prod.outlook.com (2603:10a6:20b:4::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4951.17; Fri, 11 Feb 2022 10:02:23 +0000 Received: from PAXPR06MB7760.eurprd06.prod.outlook.com ([fe80::50de:9162:7856:2782]) by PAXPR06MB7760.eurprd06.prod.outlook.com ([fe80::50de:9162:7856:2782%6]) with mapi id 15.20.4975.015; Fri, 11 Feb 2022 10:02:23 +0000 User-agent: mu4e 1.6.10; emacs 27.2 From: Ignacio Casso To: bug-gnu-emacs@gnu.org Subject: 27.2; Defining function that modifies cl-struct before defining cl-struct Date: Fri, 11 Feb 2022 10:45:50 +0100 Message-ID: Content-Type: text/plain X-TMN: [7Gvud0kgncND0+i1UpdBX/78HNLpaxLw] X-ClientProxiedBy: MR1P264CA0078.FRAP264.PROD.OUTLOOK.COM (2603:10a6:501:3f::24) To PAXPR06MB7760.eurprd06.prod.outlook.com (2603:10a6:102:155::8) X-Microsoft-Original-Message-ID: <87bkzd4t7a.fsf@hotmail.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6f5e4987-13e7-4a1d-0af2-08d9ed459914 X-MS-TrafficTypeDiagnostic: AM6PR06MB4390:EE_ X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: OcK8IF0IwjHp71OT8D/RHVN0Jd6/ypTQ5DexvMEr8pu02zENQJM1Oym+cvPYUW/YHzj5mwJdwIz9yt3Y/G1BcDcxBMA/gWMt8ElYiqWccj4wBPxtrBvUlFVF/Um0zp3w8w6fbj8Q2y2Rpi9/r0lTYajwSZLFJ5SpXB9A/049DBMax0rbxfA18Ia5Q3Klkr4I3/aF+9TDQPZykTQ+RNJIMQsy85yQgvxhxqZnEY/gMwuAH4IVI3Cm8JAq3iFn+RDbENZLJS3FFrlrF+fmwIXI7JFeeAlVjHUKwGgIwMUjCzlcmNvjuGVtR0MEsA36rUpq1Dq+oBlc2pGrbmum8bNcO+EgnB9CqhMo+xqu4BT9R0GiJBRJQ+ncHG27hvV+kEfe/CI+Lwb3rw9UK5gylfIAyJhCGNg7w9qSjKw9T8I85wpv6ez7u9FeGInz3fPzz2WYBQmKER5ErwxOCZp6JVrIYc9C0FUUiI8cWK4g2I0z+wZLFM4LFtVf0O+cvzxdd75fthArBjk4sGwXDe3moJXuE7t8GSzF245BpHX985l218Gmsg+14yZUJ4isJ6BbNQCZ8BHfeUhxp4zCpkKVer08kA== X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?R4p32agymwRmxsuWQoH2Suu36jnw9Kf0rUow6Des+AbxnyQb/gC+ec65J8iL?= =?us-ascii?Q?ebWGcelWncLb+1L1rucCDnbfZH1lD+95r5G0bcM8+F2n43g7/OQwOOkAbeL/?= =?us-ascii?Q?FD6TrWEwGG57Uzia868kbJ4Eddl4dClQuHxJbVea+FI8sfNm1Ka15vGjcOIj?= =?us-ascii?Q?CdUjcoQz+SuoFjLi8Zjq7fbrxds2IaiNcWwIwrg4DPO3eQElsW3v/CcYVP69?= =?us-ascii?Q?RAaFr5U4CkdCtSJyg7Vf65tkx8n9tiRqciFSZp6R6znlI7jRyj6D80rlrDkZ?= =?us-ascii?Q?7g7HsBhYJDShX/R9WuPd3dvKtMiRd9KS/E+GlahZmb+ODtZ+fWWN8BFezgDn?= =?us-ascii?Q?1qncOp4PrE+Zfq9PvtP5GSNljZzPCSefBwMaR+/gTtUDPUy8GOhn06ewZElM?= =?us-ascii?Q?nVcoH+cSgAqEehPMWSc25DO6dWiIL17hNvyB00P6/41cNg5s2Io0ubV41kbh?= =?us-ascii?Q?Xp1YMAd09/8hb1rEmmkbQ8XxwzZXL8mWXXAfEFhdowY4EJHtRmV6YYW2advC?= =?us-ascii?Q?kh5FXhOebWMAuwJWYFcdfmv+M2F9RQwq67ROVbabzAkegpnd1pCjFQAgLYRN?= =?us-ascii?Q?syRKpb/lUPRVd0+xT2oxZwspkszclqT3NAkIDsXEmGoolroykAYBzwAr+iUq?= =?us-ascii?Q?divHTguwmqmtwP8KlVHlVrjr2TluCeVtNsi58p8EfzmVXOM8X6divT7PVK25?= =?us-ascii?Q?I3ig1pwgxU/jL429TgKVRsou7q12FwYzhtoWiQVuOR8gCMj1n/vQYPn/Lqek?= =?us-ascii?Q?dTtE2MW4f3KIem4BB4/zPc6w/e+bozRcWLldr0l4/BePkYdW/wIouOW8cLNH?= =?us-ascii?Q?+jHW1Qg3y6BEYlJ0oyueRbpf46khuf535baI1EuAemgNFSwfsCqQ8iy+VIDT?= =?us-ascii?Q?Nf+AISUSX0hJPzPGM6R7rWP5uGTygjj9rYD4nq9OZAI/EPu3S34gFwTtPYnG?= =?us-ascii?Q?uM9uEq4h5u/aYWvou99SNA=3D=3D?= X-OriginatorOrg: sct-15-20-4755-11-msonline-outlook-6e454.templateTenant X-MS-Exchange-CrossTenant-Network-Message-Id: 6f5e4987-13e7-4a1d-0af2-08d9ed459914 X-MS-Exchange-CrossTenant-AuthSource: PAXPR06MB7760.eurprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Feb 2022 10:02:23.2651 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR06MB4390 Received-SPF: pass client-ip=40.92.72.74; envelope-from=ignaciocasso@hotmail.com; helo=EUR03-VE1-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 0.2 (/) X-Debbugs-Envelope-To: submit 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 (--) Hello, I've noticed a possible bug in Emacs. If you define a function that uses a cl struct before defining the cl struct (e.g., because the struct is defined in a package to be autoloaded and the function in your init file), there is an error when calling the function later. Here is a simple elisp file to reproduce it, starting Emacs with "emacs -Q": (require 'cl-macs) (defun change-name (struct new-name) (setf (my-struct-name struct) new-name)) (cl-defstruct my-struct name) (setq my-struct (make-my-struct)) (change-name my-struct "My struct") This produces the following error: Debugger entered--Lisp error: (void-function \(setf\ my-struct-name\)) (\(setf\ my-struct-name\) new-name v) (let* ((v struct)) (\(setf\ my-struct-name\) new-name v)) change-name(#s(my-struct :name nil) "asdf") eval((change-name my-struct "asdf") nil) elisp--eval-last-sexp(nil) eval-last-sexp(nil) funcall-interactively(eval-last-sexp nil) call-interactively(eval-last-sexp nil nil) command-execute(eval-last-sexp) A more realistic example, which produces the same error: (defun my-package-config () (setf (package-struct-slot package-var) 'new-value)) (eval-after-load 'my-package '(my-package-config)) (cl-defstruct package-struct slot) (defvar package-var (make-package-struct)) (provide 'my-package) It does not work either if we use instead a form inside eval-after-load instead of defining a function, as in this example: (eval-after-load 'my-package '(setf (package-struct-slot package-var) 'new-value)) However, it does work if we do something like this: (setq my-package-config '(setf (package-struct-slot package-var) 'new-value)) (eval-after-load 'my-package '(eval my-package-config)) I realize that this might be a design constraint given that this common lisp feature is "emulated", but maybe it should be better documented or produce more descriptive errors? It's a really uncommon case though, I only encountered it trying to configure in a weird way mu4e which uses cl structs. Regards, Ignacio In GNU Emacs 27.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.20) of 2022-01-16 built on ignacio-IdeaPad-3-15ADA05 Windowing system distributor 'The X.Org Foundation', version 11.0.12013000 System Description: Ubuntu 20.04.3 LTS From debbugs-submit-bounces@debbugs.gnu.org Sat Feb 12 01:55:58 2022 Received: (at 53938) by debbugs.gnu.org; 12 Feb 2022 06:55:59 +0000 Received: from localhost ([127.0.0.1]:33236 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nImK6-0007Kw-NU for submit@debbugs.gnu.org; Sat, 12 Feb 2022 01:55:58 -0500 Received: from quimby.gnus.org ([95.216.78.240]:38970) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nImK5-0007Kh-6y for 53938@debbugs.gnu.org; Sat, 12 Feb 2022 01:55:57 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID :In-Reply-To:Date:References:Subject:Cc:To:From:Sender:Reply-To: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=2cVGzBzdiliEQk8mwfOZvxKoBdWu4AuvrBf2iuLi1Hk=; b=XAfO1E8RhVEv1f8hp2EzcKbvnS ZEVK3pvYsyojUGMahKN8kmHhVDepDLoDO4e5Ms/vXup48/FPjBma2pp53UXJCowkyPlWp6qORKhNG aTyHCcfvcIKRpJMCuGCoHk3WW8WoX5atb9IlcvHREjBKOieGfw8uQzwha6AZ+qRRILlU=; Received: from [84.212.220.105] (helo=giant) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nImJv-0004Nd-5b; Sat, 12 Feb 2022 07:55:50 +0100 From: Lars Ingebrigtsen To: Ignacio Casso Subject: Re: bug#53938: 27.2; Defining function that modifies cl-struct before defining cl-struct References: X-Now-Playing: Yukihiro Takahashi's _Blue Moon Blue_: "Blue Moon Blue" Date: Sat, 12 Feb 2022 07:55:46 +0100 In-Reply-To: (Ignacio Casso's message of "Fri, 11 Feb 2022 10:45:50 +0100") Message-ID: <87bkzc60b1.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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: Ignacio Casso writes: > If you define a function that uses a cl struct before defining the cl > struct (e.g., because the struct is defined in a package to be autoloaded and the > function in your init file), there is an e [...] 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: 53938 Cc: 53938@debbugs.gnu.org, Stefan Monnier 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 (---) Ignacio Casso writes: > If you define a function that uses a cl struct before defining the cl > struct (e.g., because the struct is defined in a package to be autoloaded= and the > function in your init file), there is an error when calling the function > later. > > Here is a simple elisp file to reproduce it, starting Emacs with "emacs > -Q": > > (require 'cl-macs) > > (defun change-name (struct new-name) > (setf (my-struct-name struct) new-name)) > > (cl-defstruct my-struct > name) > > (setq my-struct (make-my-struct)) > > (change-name my-struct "My struct") > > This produces the following error: > > Debugger entered--Lisp error: (void-function \(setf\ my-struct-name\)) > (\(setf\ my-struct-name\) new-name v) If you'd byte-compiled this, then the compiler would say In end of data: cl.el: Warning: the function =E2=80=98(setf my-struct-name)=E2=80=99 is not= known to be defined. So I think that Emacs is probably working as designed here. But perhaps Stefan has some comments; added to the CCs. --=20 (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From debbugs-submit-bounces@debbugs.gnu.org Sat Feb 12 01:56:05 2022 Received: (at control) by debbugs.gnu.org; 12 Feb 2022 06:56:05 +0000 Received: from localhost ([127.0.0.1]:33240 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nImKC-0007Lg-Vp for submit@debbugs.gnu.org; Sat, 12 Feb 2022 01:56:05 -0500 Received: from quimby.gnus.org ([95.216.78.240]:38992) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nImKB-0007Kv-QL for control@debbugs.gnu.org; Sat, 12 Feb 2022 01:56:04 -0500 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=AJh24IOaMMyItcMz0v4YG6pYeWZnUW5Km9mCilDZ4HM=; b=forGxKOhwadGjr4pMmj7oy0222 gRdY/tGEqA5P1g9oz6Z/60cQrezZuoN/TayKz6UvTdl51FECPTeqhWyZzRjYOuG5U9AHWKyU+wYib CVlDMm1dCJxUaZj1sH1WBXFK16yXMYFAus+mgag61lJK5v97ei2oecKO1ocsknDIfsJY=; Received: from [84.212.220.105] (helo=giant) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nImK3-0004Nk-Kl for control@debbugs.gnu.org; Sat, 12 Feb 2022 07:55:57 +0100 Date: Sat, 12 Feb 2022 07:55:51 +0100 Message-Id: <87a6ew60aw.fsf@gnus.org> To: control@debbugs.gnu.org From: Lars Ingebrigtsen Subject: control message for bug #53938 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: tags 53938 + moreinfo 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 (---) tags 53938 + moreinfo quit From debbugs-submit-bounces@debbugs.gnu.org Sat Feb 12 09:45:57 2022 Received: (at 53938) by debbugs.gnu.org; 12 Feb 2022 14:45:57 +0000 Received: from localhost ([127.0.0.1]:33824 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nItev-0002Zq-3Y for submit@debbugs.gnu.org; Sat, 12 Feb 2022 09:45:57 -0500 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:35878) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nItes-0002Zc-Bj for 53938@debbugs.gnu.org; Sat, 12 Feb 2022 09:45:55 -0500 Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 18B888070D; Sat, 12 Feb 2022 09:45:47 -0500 (EST) Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 96A1C80008; Sat, 12 Feb 2022 09:45:45 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1644677145; bh=aQR/0TrPQZGA9TXfl1FtrDvhMxTV1ZKqosTjNEQQHUc=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=UCFA3RPNViageqDRlkq2iLjpmMdxLhrzGwcP0jqQo6xj+p23iqiz7Nf50IotiwwSe NcT4Hvv7T9QBNcISWgCPq0vDHi7hrp/UViSJXmrQx5nPLyGCb7qkUMSyh2dhrmvlmS 0oj+E/aYAagKT9RSHRm8f5AEMCcYZrqPCMD2lZulxhle2zW8ewgM2fzCAuoEidXKdo xImLEJsz+OQX4UjKea6321qDhNe87iI/N+biBc778zAiOmHIqvmyCv5uzKziZHcQeg O6ugzV81mn7jjKIiXp16AFAlCwqx+hFudI4JY6QlQ+E6OPlL2D2ylmGNkRiAeivxbD PojzuElQwESbw== Received: from ceviche (modemcable034.207-20-96.mc.videotron.ca [96.20.207.34]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 75655120210; Sat, 12 Feb 2022 09:45:45 -0500 (EST) From: Stefan Monnier To: Lars Ingebrigtsen Subject: Re: bug#53938: 27.2; Defining function that modifies cl-struct before defining cl-struct Message-ID: References: <87bkzc60b1.fsf@gnus.org> Date: Sat, 12 Feb 2022 09:45:44 -0500 In-Reply-To: <87bkzc60b1.fsf@gnus.org> (Lars Ingebrigtsen's message of "Sat, 12 Feb 2022 07:55:46 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.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.036 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 T_SCC_BODY_TEXT_LINE -0.01 - X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 53938 Cc: Ignacio Casso , 53938@debbugs.gnu.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: -3.3 (---) Lars Ingebrigtsen [2022-02-12 07:55:46] wrote: > Ignacio Casso writes: >> If you define a function that uses a cl struct before defining the cl >> struct (e.g., because the struct is defined in a package to be autoloade= d and the >> function in your init file), there is an error when calling the function >> later. >> >> Here is a simple elisp file to reproduce it, starting Emacs with "emacs >> -Q": >> >> (require 'cl-macs) Please require `cl-lib` rather than `cl-macs` here. >> (defun change-name (struct new-name) >> (setf (my-struct-name struct) new-name)) >> >> (cl-defstruct my-struct >> name) >> >> (setq my-struct (make-my-struct)) >> >> (change-name my-struct "My struct") >> >> This produces the following error: >> >> Debugger entered--Lisp error: (void-function \(setf\ my-struct-name\)) >> (\(setf\ my-struct-name\) new-name v) > > If you'd byte-compiled this, then the compiler would say > > In end of data: > cl.el: Warning: the function =E2=80=98(setf my-struct-name)=E2=80=99 is n= ot known to be > defined. > > So I think that Emacs is probably working as designed here. But perhaps > Stefan has some comments; added to the CCs. Yes, it's working as designed (because the accessors are supposed to be inlined). OTOH, it should work like you want it if you pass the :noinline option to `cl-defstruct`. Stefan From debbugs-submit-bounces@debbugs.gnu.org Sun Feb 13 03:22:37 2022 Received: (at 53938) by debbugs.gnu.org; 13 Feb 2022 08:22:37 +0000 Received: from localhost ([127.0.0.1]:36195 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nJA9V-0002q2-Hh for submit@debbugs.gnu.org; Sun, 13 Feb 2022 03:22:37 -0500 Received: from quimby.gnus.org ([95.216.78.240]:50560) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nJA9U-0002pk-92 for 53938@debbugs.gnu.org; Sun, 13 Feb 2022 03:22:36 -0500 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=nieMHTnlmgBuNRlpc90eouXiP2spe1hBM487EDgDOuk=; b=SllXuPgFSsk8IhlwLf2ceemcGD RhL0WJ+iZosBObYmEtbjW8p1L0LV378k65gIfs7wMTvvJSuCRBEVMbNwbz03ri4AmhjNffzQaX8d3 pQEt4NdsE5jxXPXliU9RrQFImHw2dbzpJnGNUGrF8yeEUCwX/vi6z0FSy8DfTEmctHU8=; Received: from [84.212.220.105] (helo=giant) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nJA9K-0000Vs-EM; Sun, 13 Feb 2022 09:22:29 +0100 From: Lars Ingebrigtsen To: Stefan Monnier Subject: Re: bug#53938: 27.2; Defining function that modifies cl-struct before defining cl-struct References: <87bkzc60b1.fsf@gnus.org> Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAACBj SFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAElBMVEXY2MaplDYvPSg6 Wi1FaDD///8TZ0UnAAAAAWJLR0QF+G/pxwAAAAd0SU1FB+YCDQgNNB5qAsIAAAFmSURBVDjLnZTr kYMwDIS5EphJBZAKkBogq/5rutXLmFzy5zwwZPx59VhElp9dYSoGs7j9IYplSQDfRMM9gUB5KRCA BLtJKESEakOHsgYg0AiSxM9lKKiDsVhKAl9D4ZcmMB4YxZ52ASpH2ljHCEWkHQue3LLBFnAXpwP2 VJ3HWT4liyoFK+KGevlxJPoqhVdL7zwMPThYfjZIhSfSNJIAXa6WE1FBeJcA0UlZdoF0BBIm80BY NAGk+Wzi2C+FBUg7hVUd2YeDklhGmhS+K163uKKBp1BvUP8oUFUhFceoKhMjfrGqApiAhVevAdBA 3kKhRkKmHCrhqkY7BJPt6oarJ+aAyWWip8hYilJ4qG2TY4u11+y9GnxaBLLJPLgWb8Zz6DNGc30M 4KYRPOc5L0WDcz3XilKh3hW3HM/7qMfgfQEclAZEjwloA8Vd0X8AbpHF++bto6fjnUPmRDj9+1jW j+tf4Mv6BUmW4HKok9CDAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDIyLTAyLTEzVDA4OjEzOjUyKzAw OjAwV9N+0QAAACV0RVh0ZGF0ZTptb2RpZnkAMjAyMi0wMi0xM1QwODoxMzo1MiswMDowMCaOxm0A AAAASUVORK5CYII= X-Now-Playing: Sidsel Endresen's _Undertow_: "Undertow" Date: Sun, 13 Feb 2022 09:22:25 +0100 In-Reply-To: (Stefan Monnier's message of "Sat, 12 Feb 2022 09:45:44 -0500") Message-ID: <87mtivyy4e.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.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: > Yes, it's working as designed (because the accessors are supposed to be > inlined). OTOH, it should work like you want it if you pass > the :noinline option to `cl-defstruct`. 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: 53938 Cc: Ignacio Casso , 53938@debbugs.gnu.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: -3.3 (---) Stefan Monnier writes: > Yes, it's working as designed (because the accessors are supposed to be > inlined). OTOH, it should work like you want it if you pass > the :noinline option to `cl-defstruct`. Thanks; then I guess there's nothing to be fixed here, and I'm closing this bug report. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From debbugs-submit-bounces@debbugs.gnu.org Sun Feb 13 03:22:46 2022 Received: (at control) by debbugs.gnu.org; 13 Feb 2022 08:22:46 +0000 Received: from localhost ([127.0.0.1]:36198 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nJA9d-0002qM-QW for submit@debbugs.gnu.org; Sun, 13 Feb 2022 03:22:45 -0500 Received: from quimby.gnus.org ([95.216.78.240]:50576) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nJA9c-0002qA-3N for control@debbugs.gnu.org; Sun, 13 Feb 2022 03:22:44 -0500 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=v1FaYgRrNu/Kzc3LHG7yAOsQViEsbTse/kQcfG1vUjY=; b=q9PBO1YZs2HgnkoYHl4NYd3xR9 NU2nap9Fu6f7sdclqOBpNzikR3Q27f8pEf+OAiCv0BalB5UjiH+616AE/mB2+11HKfuWfK3RVNJaL cR4A2NtyNS/XFdip4XeWean9VXVRPdbxr0UN5Who7nOzMdklZ29jn3gO4zzIVrd4PprU=; Received: from [84.212.220.105] (helo=giant) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nJA9T-0000W3-Np for control@debbugs.gnu.org; Sun, 13 Feb 2022 09:22:38 +0100 Date: Sun, 13 Feb 2022 09:22:35 +0100 Message-Id: <87leyfyy44.fsf@gnus.org> To: control@debbugs.gnu.org From: Lars Ingebrigtsen Subject: control message for bug #53938 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: tags 53938 notabug close 53938 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 (---) tags 53938 notabug close 53938 quit From unknown Sat Jun 21 05:16:59 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sun, 13 Mar 2022 11:24:05 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator