From unknown Thu Jun 19 12:37:40 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#54652 <54652@debbugs.gnu.org> To: bug#54652 <54652@debbugs.gnu.org> Subject: Status: [PATCH 1/2] guix: Only check the object type once in the MATCH-RECORD expansion. Reply-To: bug#54652 <54652@debbugs.gnu.org> Date: Thu, 19 Jun 2025 19:37:40 +0000 retitle 54652 [PATCH 1/2] guix: Only check the object type once in the MATC= H-RECORD expansion. reassign 54652 guix-patches submitter 54652 Attila Lendvai severity 54652 normal tag 54652 patch thanks From debbugs-submit-bounces@debbugs.gnu.org Thu Mar 31 08:48:41 2022 Received: (at submit) by debbugs.gnu.org; 31 Mar 2022 12:48:41 +0000 Received: from localhost ([127.0.0.1]:38232 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nZuED-00053C-AF for submit@debbugs.gnu.org; Thu, 31 Mar 2022 08:48:41 -0400 Received: from lists.gnu.org ([209.51.188.17]:39350) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nZuEB-000533-PA for submit@debbugs.gnu.org; Thu, 31 Mar 2022 08:48:40 -0400 Received: from eggs.gnu.org ([209.51.188.92]:33616) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nZuEB-0002XM-Fz for guix-patches@gnu.org; Thu, 31 Mar 2022 08:48:39 -0400 Received: from [2a00:1450:4864:20::62d] (port=46684 helo=mail-ej1-x62d.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nZuE9-0004uX-NP for guix-patches@gnu.org; Thu, 31 Mar 2022 08:48:39 -0400 Received: by mail-ej1-x62d.google.com with SMTP id c10so29472369ejs.13 for ; Thu, 31 Mar 2022 05:48:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=xjbLRrxys9+mq7HbWwjU0J9dJiSyGgcAJyi+rfWxN20=; b=DwrAQHigqZhYk4wUarxiTaoo41EFKiXga7kBBnrxzGc3IAfQW4gPuVKliQ2IsXkULU FValKlkgaFwGJargNC9bDEtrtQBjFyb9wGiZ8cLIZKmUAtmxMzk7tM2+3eFgvpxFQXu1 m7494oG2AxEJE98nzrMiNCp+u88MrqvzVGT5iOthMB/qGKP1OfktWi40yCcMLZsSYiia PJdtXhC+kAe3jl8emVM4CFcIRcrt4hzFWarUJRiyraXgfxHG63qFTGMSejhHYlxv24Ul KGvWrweKqQtyyyQfYxJTBmzJr4AkqJ5c9kBA6Q8B8h8WzQScHAjImnGy5mY5vDtvnMf8 ZBMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :mime-version:content-transfer-encoding; bh=xjbLRrxys9+mq7HbWwjU0J9dJiSyGgcAJyi+rfWxN20=; b=HbwrgwMyUuvN1kvbgGz4qEuOGaZpXtqcC1pNKU16CquXVC5YSOGGepsQpUdH6U0qy6 ZDuLf7YRSnBWjq43VIunFq94xpr7sJO5y6cbncQaSHZzut8OXLUyxg80zbhEU4PiLxfv YAwzLoTMJi8jSnu1FarO7foRy8JeFKiFViZskVMFGuaPQZuBec7KSyM7/Rq7ghCf94WL tCMsbebgtJ36kjIi5YAZxUha9hOO4molKTtNzsFoxTmzOG/v8RZMWKQOeag40ipZuAfy bFYswQ3ygmLxjiAjgoJcnEQrTWRhszeVCrYywylOBKvsWCgx8IdPuPbGt41FMT2UmeOB zT8g== X-Gm-Message-State: AOAM532gnKceY8pxigCdn6fmT88pZmpolfT42IlR+E8mBI+YN/vs5N+T LVN2KPrC2zPx+38ETxobtuTvCL5jInE= X-Google-Smtp-Source: ABdhPJzoY3ubVdGZ0BYp5RtnRhxuQuVF+iWaZXA/wOISBxLxi4SWcD4U9xCnpYCfRH6zScq1aCAiVw== X-Received: by 2002:a17:907:96a9:b0:6e0:db4a:ba8d with SMTP id hd41-20020a17090796a900b006e0db4aba8dmr4898698ejc.87.1648730915558; Thu, 31 Mar 2022 05:48:35 -0700 (PDT) Received: from lelap.local (catv-89-132-245-188.catv.fixed.vodafone.hu. [89.132.245.188]) by smtp.gmail.com with ESMTPSA id l20-20020a1709062a9400b006ce71a88bf5sm9262915eje.183.2022.03.31.05.48.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 31 Mar 2022 05:48:35 -0700 (PDT) From: Attila Lendvai To: guix-patches@gnu.org Subject: [PATCH 1/2] guix: Only check the object type once in the MATCH-RECORD expansion. Date: Thu, 31 Mar 2022 14:46:57 +0200 Message-Id: <20220331124657.2985-1-attila@lendvai.name> X-Mailer: git-send-email 2.34.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::62d (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::62d; envelope-from=attila.lendvai@gmail.com; helo=mail-ej1-x62d.google.com X-Spam_score_int: 0 X-Spam_score: -0.1 X-Spam_bar: / X-Spam_report: (-0.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-Spam-Score: 0.7 (/) X-Debbugs-Envelope-To: submit Cc: Attila Lendvai 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.8 (-) * guix/records.scm (match-record/fields): New macro. (match-record): Only check the object type once in the expansion. --- guix/records.scm | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/guix/records.scm b/guix/records.scm index ed94c83dac..e311086d73 100644 --- a/guix/records.scm +++ b/guix/records.scm @@ -535,17 +535,25 @@ (define (recutils->alist port) (else (error "unmatched line" line)))))))) +(define-syntax match-record/fields + (syntax-rules () + ((_ record type (field fields ...) body ...) + (let ((field ((record-accessor type 'field) record))) + ;; TODO compute indices and report wrong-field-name errors at + ;; expansion time + ;; TODO support thunked and delayed fields + (match-record/fields record type (fields ...) body ...))) + ((_ record type () body ...) + (begin body ...)))) + (define-syntax match-record (syntax-rules () "Bind each FIELD of a RECORD of the given TYPE to it's FIELD name. The current implementation does not support thunked and delayed fields." ((_ record type (field fields ...) body ...) (if (eq? (struct-vtable record) type) - ;; TODO compute indices and report wrong-field-name errors at - ;; expansion time - ;; TODO support thunked and delayed fields - (let ((field ((record-accessor type 'field) record))) - (match-record record type (fields ...) body ...)) + ;; So that we only test the type once. + (match-record/fields record type (field fields ...) body ...) (throw 'wrong-type-arg record))) ((_ record type () body ...) (begin body ...)))) -- 2.34.0 From debbugs-submit-bounces@debbugs.gnu.org Thu Mar 31 08:54:42 2022 Received: (at 54652) by debbugs.gnu.org; 31 Mar 2022 12:54:42 +0000 Received: from localhost ([127.0.0.1]:38241 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nZuK2-0005Cj-Dg for submit@debbugs.gnu.org; Thu, 31 Mar 2022 08:54:42 -0400 Received: from mail-ej1-f53.google.com ([209.85.218.53]:38565) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nZuK0-0005CW-L3 for 54652@debbugs.gnu.org; Thu, 31 Mar 2022 08:54:41 -0400 Received: by mail-ej1-f53.google.com with SMTP id r13so47908021ejd.5 for <54652@debbugs.gnu.org>; Thu, 31 Mar 2022 05:54:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Mg1NnyEMbF0Qpd/WMY0lgAk90fwyWJ/nVdVU5N62754=; b=pIZTMS6VezqLN3cCsPHYH9+4z+0vLbjhnMr1kUuk/Jcaxwn2SEI1wgMkJOIzfBJ1xB u/9RUjk8jaApYxbrdP+mRf2Y4JILT0Iq3BUBRgatFh+ILQ4W44fugBKvyIA9XUiAbX03 zaL7viGP/ZyQIIokKWhZMSka1qiHH5848k73nBR63kPFSgDMdHb9bcQvIHZjpNP3kqDn MWgVTBuKU4czCQtvqWO3HhyzTCu90Wy2TpNXZLRTtvNyeMuuo9HSg0QCXK6Hsc8weHED AuCEYTdUJppM+tAvAtwtzpJps/p2+khsjr4zBVsLVe5bqIh/iLwx8EMoJTb8d1UMaE55 XqGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :mime-version:content-transfer-encoding; bh=Mg1NnyEMbF0Qpd/WMY0lgAk90fwyWJ/nVdVU5N62754=; b=czkALxfpSPxm/RQHe9ZDx59/3EYWChCf4mSLO/L5oezp8NAkVq+sPpS3WesEFOofuT XFezjfHjQD0zKFUE5Pd1Kx2luz9g/Y2xKsPIQ3KH/wGzDiAOZjDpu4EGza8QigtDOQJU HwTMtA75A4qqm8/xEFpbT+tHjPvD11D6bWreD2xVDRf74wecuiBBklF1PKeM0pB1JJRe 29PbJhuPltkCit8oSZF0adBG1fbB7sdRgaPN5bllooSp9No6syjLxK+nU+NMITG1VbYI zZpWjY4YnzR0WNO46NdAm/XlWbjsds9PXhwa6sYHSeJZTRUAQcgfEKRhBSwmDA5wKD9x Rh1A== X-Gm-Message-State: AOAM533K2bbIAibymH6IzjC/OrxIF0BRgtF5IPfxzSUU83TwCQrdGCEa tQFcsGTmxrorD01SG4gEXKjT+c7kPOc= X-Google-Smtp-Source: ABdhPJy7Krvv9qVCj0nSg869lvmxrcOwMkVQ0/AlLIPj54oAkBKTwAb47vn1bDcqC7yyydQz9RWilA== X-Received: by 2002:a17:906:99c1:b0:6db:f0cf:e38c with SMTP id s1-20020a17090699c100b006dbf0cfe38cmr4819422ejn.692.1648731274550; Thu, 31 Mar 2022 05:54:34 -0700 (PDT) Received: from lelap.local (catv-89-132-245-188.catv.fixed.vodafone.hu. [89.132.245.188]) by smtp.gmail.com with ESMTPSA id bm23-20020a170906c05700b006d597fd51c6sm9581912ejb.145.2022.03.31.05.54.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 31 Mar 2022 05:54:34 -0700 (PDT) From: Attila Lendvai To: 54652@debbugs.gnu.org Subject: [PATCH 2/2] guix: MATCH-RECORD supports (FIELD-NAME VARIABLE-NAME) forms. Date: Thu, 31 Mar 2022 14:52:31 +0200 Message-Id: <20220331125230.4388-2-attila@lendvai.name> X-Mailer: git-send-email 2.34.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Score: 0.5 (/) X-Debbugs-Envelope-To: 54652 Cc: Attila Lendvai 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.5 (/) E.g. (match-record obj (field1 (field2 var-name)) ...) * guix/records.scm (match-record/fields): Implement it. --- a real world example i was facing: a field name is the same as an object constructor, and thus shadows it in a match-record form, unless a different variable name is chosen. guix/records.scm | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/guix/records.scm b/guix/records.scm index e311086d73..492ab2aed6 100644 --- a/guix/records.scm +++ b/guix/records.scm @@ -537,12 +537,15 @@ (define (recutils->alist port) (define-syntax match-record/fields (syntax-rules () - ((_ record type (field fields ...) body ...) - (let ((field ((record-accessor type 'field) record))) + ((_ record type ((field-name variable-name) fields ...) body ...) + (let ((variable-name ((record-accessor type 'field-name) record))) ;; TODO compute indices and report wrong-field-name errors at ;; expansion time ;; TODO support thunked and delayed fields (match-record/fields record type (fields ...) body ...))) + ((_ record type (field fields ...) body ...) + ;; Channel it back into the canonical form above. + (match-record/fields record type ((field field) fields ...) body ...)) ((_ record type () body ...) (begin body ...)))) -- 2.34.0 From debbugs-submit-bounces@debbugs.gnu.org Thu Jun 30 09:56:28 2022 Received: (at 54652) by debbugs.gnu.org; 30 Jun 2022 13:56:28 +0000 Received: from localhost ([127.0.0.1]:33755 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o6uei-0007vP-1i for submit@debbugs.gnu.org; Thu, 30 Jun 2022 09:56:28 -0400 Received: from mail-4323.proton.ch ([185.70.43.23]:47637) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o6uee-0007uw-Kt for 54652@debbugs.gnu.org; Thu, 30 Jun 2022 09:56:27 -0400 Date: Thu, 30 Jun 2022 13:56:13 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lendvai.name; s=protonmail; t=1656597377; x=1656856577; bh=ACjLn8gyWjuZA9HUyuunBWaWElx4PnFN95B534WoYJQ=; h=Date:To:From:Reply-To:Subject:Message-ID:Feedback-ID:From:To:Cc: Date:Subject:Reply-To:Feedback-ID:Message-ID; b=ksrT4FYPoOD/392QB1xraPElKcT2xuyH8zBdk+Rx0XtOo1adpsiijT090RdTitO70 LrnFzBYsCUlRHCqRRoysImh1/hv//Vq+6Aw07t5AhbpbGUDuk5LGYd9kf7zN0o3AdO sHMIRnoWC/hjpO0iyRrQ16RV8o9z9bqSNF/74RLp4ziZk6k9YgOh9uX0U8cHlYOn5N 3dbXjdUK3xK6EHDMrr2vd1jiquqp31XnDiD2/zEx/gEQlwyNCLBan6I022+lumjD8a 1VhQvgVdLymQEGVMU/FQITJSxRqASUo2i+xOAkBr20da6hyJaVAt9A0IZFT8Qbofde YitEfuSSGBH/A== To: "54652@debbugs.gnu.org" <54652@debbugs.gnu.org> From: Attila Lendvai Subject: (No Subject) Message-ID: Feedback-ID: 28384833:user:proton MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 2.0 (++) 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: one questionable thing: if fields is the empty list, then it skips entirely the runtime assert that checks the record type. Content analysis details: (2.0 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 2.0 SLIGHTLY_BAD_SUBJECT Subject contains something slightly spammy -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [185.70.43.23 listed in wl.mailspike.net] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 T_SCC_BODY_TEXT_LINE No description available. X-Debbugs-Envelope-To: 54652 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: , Reply-To: Attila Lendvai Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 1.0 (+) one questionable thing: if fields is the empty list, then it skips entirely= the runtime assert that checks the record type. From debbugs-submit-bounces@debbugs.gnu.org Sun Nov 20 09:18:32 2022 Received: (at 54652-close) by debbugs.gnu.org; 20 Nov 2022 14:18:32 +0000 Received: from localhost ([127.0.0.1]:42761 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1owl9U-0005nE-DW for submit@debbugs.gnu.org; Sun, 20 Nov 2022 09:18:32 -0500 Received: from mail-4323.proton.ch ([185.70.43.23]:54877) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1owl9Q-0005mv-Hn for 54652-close@debbugs.gnu.org; Sun, 20 Nov 2022 09:18:31 -0500 Date: Sun, 20 Nov 2022 14:18:11 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lendvai.name; s=protonmail; t=1668953901; x=1669213101; bh=pYDqgamebXuHwnGMhYocLbx56+O5WRcOkPCpVPmlzSA=; h=Date:To:From:Subject:Message-ID:Feedback-ID:From:To:Cc:Date: Subject:Reply-To:Feedback-ID:Message-ID:BIMI-Selector; b=fC+nsRN45+u3yjh4I18py1S0tJp+pYUqh6AlwmtGrX0UuKhJa7rugltpHs+x+igYB R1BE38Fl8eiwhqz4BFFCCWtAbvq+5upmhc3aafqlCnglSTE0B/iPKmoEpr5V0hk5lH mLqwdsb1mUST9NNVIeauxDpT6gkXI2KgiZdxPi6lndb9o1JpEn/Xz3yjqo5RA7rBes nQdLRk1UIBV2NVeloMi0Ud5hLSMkmzbl8x9BRsnQaJV0KJilzJML2PTZiXv0dT0xNw x1BKODxAR4HNQ293tlrRHkuJQdh8rgOX8E1c7lXon7qwyLKhmaevol+OjbaEOTGyoB 9iiYnRIjEt1ow== To: "54652-close@debbugs.gnu.org" <54652-close@debbugs.gnu.org> From: Attila Lendvai Subject: (No Subject) Message-ID: Feedback-ID: 28384833:user:proton MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 2.0 (++) 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: closing, it was superseded by #59390 https://issues.guix.gnu.org/59390 -- • attila lendvai • PGP: 963F 5D5F 45C7 DFCD 0A39 -- “Personal dishonesty is not needed to produce a dishonest business plan or research proposal. Wishful thinking suffices.” — John McCart [...] Content analysis details: (2.0 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 2.0 SLIGHTLY_BAD_SUBJECT Subject contains something slightly spammy -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [185.70.43.23 listed in wl.mailspike.net] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record X-Debbugs-Envelope-To: 54652-close 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 (+) closing, it was superseded by #59390 https://issues.guix.gnu.org/59390 --=20 =E2=80=A2 attila lendvai =E2=80=A2 PGP: 963F 5D5F 45C7 DFCD 0A39 -- =E2=80=9CPersonal dishonesty is not needed to produce a dishonest business = plan or research proposal. Wishful thinking suffices.=E2=80=9D =09=E2=80=94 John McCarthy (1927=E2=80=932011), father of Lisp From unknown Thu Jun 19 12:37:40 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Mon, 19 Dec 2022 12:24:10 +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