From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id qDBRIdbqe2N8JAEAbAwnHQ (envelope-from ) for ; Mon, 21 Nov 2022 22:17:10 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id SNY4Idbqe2NNfQAAauVa8A (envelope-from ) for ; Mon, 21 Nov 2022 22:17:10 +0100 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 0CC513E516 for ; Mon, 21 Nov 2022 22:17:10 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oxE9l-00018J-Lv; Mon, 21 Nov 2022 16:16:45 -0500 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 1oxE9k-000188-Mx for guix-devel@gnu.org; Mon, 21 Nov 2022 16:16:44 -0500 Received: from mail-qk1-x72c.google.com ([2607:f8b0:4864:20::72c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oxE9i-0006cu-QD; Mon, 21 Nov 2022 16:16:44 -0500 Received: by mail-qk1-x72c.google.com with SMTP id k4so8949789qkj.8; Mon, 21 Nov 2022 13:16:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:user-agent:message-id :in-reply-to:date:references:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to; bh=mExVbu9E73R2ROoh1NMUugzAxxTr+8Xaaag6aDraDbo=; b=BNbwXbyFztRtNeSYeoRGbwrfjL0l8PkETKn1rm+q9wmGxJda6+Lvpymvq7WIU5f3lg LpYjyRkJ/nOwWoP2SysHN3xqtoS0VZiYxJVKkGll/Uq/Bm29LXqgfWkQ81pzCwZpD3cN cAoXc2dPw4hqO2WR64n964eNLr6kNBrDPe42v0WyJbaZssYWWgFfe4BFqUpTnptaxZyM DfsF0tOu31pKXHb/IJB+w8LISoahK62EZguQgH6rumGeWsTYXcjb7biCNWMOmZ8oJ/5U DNQvmYje88mfu3BKv24wDcWjchhMrVtLghksOtSZp1leMIv95GJS5fK9zePMtwPijH++ JTLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:user-agent:message-id :in-reply-to:date:references:subject:cc:to:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=mExVbu9E73R2ROoh1NMUugzAxxTr+8Xaaag6aDraDbo=; b=BIpEzFRfw0mwbJeHsysYYC1PPloU802BSLKleTpt/QypTbFoscpS0uwxWvgdyM0QJR bGEZ46ak3aJzgB26mEdUUjh3XvJDO05FnnR7/4267xW9zZotoI5eLqVzcH5ULtL3mphw mpNegQ0wm6Z8ooZ03BDcXGLFW9G3gCLQjdyYu7A5NEuvEc3hKTufFS3p6b3xgKcGClaI NGV3V5hOdglB3ehxUtZxSSeSiIqR6oBOAvdVbhHVIb2rpLmcfIlhxlxXMNvxKoCpoO/l NZpt/Ut95qgaaoHhxjVQZZWyBlJlv70GFn/FPIvKc+upPD/1ZAWRh8Tt/MTYsxZ2RDrC szmw== X-Gm-Message-State: ANoB5plHbGHU+pSqAN+WKsDdUtU7hxXsQtIJ31TeGc2otM25bsFoexta krvK1jRdVHZL47RA9Mw7eS4iqT/ngNw= X-Google-Smtp-Source: AA0mqf4qdGbeEanI1IDglgG9l+n2dSc0fHB515vH+f52M5SUugGjJRFQ/hTRZYgmhaYeQikFHlBAfA== X-Received: by 2002:a05:620a:958:b0:6ea:ba87:4385 with SMTP id w24-20020a05620a095800b006eaba874385mr17967578qkw.128.1669065401120; Mon, 21 Nov 2022 13:16:41 -0800 (PST) Received: from hurd ([2607:fad8:4:3::1003]) by smtp.gmail.com with ESMTPSA id t4-20020ac87384000000b0039cba52974fsm7223029qtp.94.2022.11.21.13.16.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Nov 2022 13:16:40 -0800 (PST) From: Maxim Cournoyer To: Ludovic =?utf-8?Q?Court=C3=A8s?= Cc: guix-devel@gnu.org Subject: Re: Layout of =?utf-8?Q?=E2=80=98define-configuration=E2=80=99?= records References: <20221029034716.11125-1-maxim.cournoyer@gmail.com> <20221029041649.12144-1-maxim.cournoyer@gmail.com> <87zgcpdx6q.fsf_-_@gnu.org> <8735ag43ga.fsf@gmail.com> <87zgckli8u.fsf@gnu.org> Date: Mon, 21 Nov 2022 16:16:40 -0500 In-Reply-To: <87zgckli8u.fsf@gnu.org> ("Ludovic =?utf-8?Q?Court=C3=A8s=22'?= =?utf-8?Q?s?= message of "Mon, 21 Nov 2022 11:22:25 +0100") Message-ID: <87edtwqa87.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=2607:f8b0:4864:20::72c; envelope-from=maxim.cournoyer@gmail.com; helo=mail-qk1-x72c.google.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, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: guix-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+larch=yhetil.org@gnu.org Sender: guix-devel-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1669065430; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=mExVbu9E73R2ROoh1NMUugzAxxTr+8Xaaag6aDraDbo=; b=baPAAyrE/FWAd0KJ9bp2Qpa8oiJRGx2QzNFv0B2aXUgCENPW6qfaz8ml7CPCP27Jydnn9D LRlukxeT3imlt8k8dcrAjQ01pdHljKpEuUuvFzko24GnMZqRmFEwpQMmovng9k8pIGfUs6 iDvn2DwEWwbsEtT+NQCikXPT5GjjIYk/X/NBZzFR5PsZSysBT58AZo3gsDjra1Lw290bA/ 0tHrh4mPSqwWwC6K3PLsjBCo7B+QHAFsoBVopymK9V4LjB/UzP5h50nxSMpBC6VyAkLUT4 ONAM5BTnRlq9pNQF9rH+otv0aaffI0clnaVqgHhqWaZxMK4DYKGmrd37j7MtMg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1669065430; a=rsa-sha256; cv=none; b=GPBBBkwPGNIlV2kLQyZMDCdppUBwOfs7B6WJdE5mni8+jAHEOn2okZUGlSTAa5pCug0Kkv FMRHPDBMveBexbJVqMGhvf8PyLiTmpv5z59fXbyryyKrB9giipKBDElLSG86SxpzJnAsJf 1Wvn2AmgrG7mzuaIkRazTDVPVlPVsbFGTlYNWqCDvhvxkmgIiTJjRYBbQkH/7y8V8FfWsE sOuRMh3Esd17FPvftVJUslkCZnWdhbBTsbuvHR9cxGyVYMGPcP3BpyZkHmbDuQa4ZJpxZj qKgl4cZtVyHQGLUUclDty9NyMUlWH7F5/0ENjUoDI2QSLQX7ulx8qSihJHAwuA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=BNbwXbyF; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of "guix-devel-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-devel-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -2.51 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=BNbwXbyF; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of "guix-devel-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-devel-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 0CC513E516 X-Spam-Score: -2.51 X-Migadu-Scanner: scn1.migadu.com X-TUID: g2RzqVY7b4G8 Hi, Ludovic Court=C3=A8s writes: > Hi Maxim, > > Maxim Cournoyer skribis: > >> Ludovic Court=C3=A8s writes: > > [...] > >>>> + (%location #,(id #'stem #'stem #'-location) >>>> + (default (and=3D> (current-source-location) >>>> + source-properties->location= )) >>>> + (innate))) >>> >>> Moving the field last is problematic as we=E2=80=99ve seen for any user= that >>> uses =E2=80=98match=E2=80=99 on records=E2=80=94something that=E2=80=99= s not recommended but still used >>> a lot. >> >> Yep. I had that on mind when I made the change, though I still missed a >> few occurrences. > > [...] > >> I wanted match on define-configuration'd fields to be >> backward-compatible with fields migrated from define-record-type*, so >> that they such change can be made without worrying breakages. > > That had the opposite effect: it introduced breakage precisely because > existing uses of =E2=80=98match=E2=80=99 on records need to be verified m= anually, one by > one. Yes. C.f. "I missed a few occurrences" above :-). > That led me to improve =E2=80=98match-record=E2=80=99, to recommend it in= the manual, > and do =E2=80=9Cconvert=E2=80=9D some uses of =E2=80=98match=E2=80=99 to = =E2=80=98match-record=E2=80=99: > > https://issues.guix.gnu.org/59390 > > That=E2=80=99s a good outcome, but I=E2=80=99d prefer not feeling this ki= nd of pressure. Neat (not the under pressure part)! Perhaps srfi-worthy? >> I initially got tricked by that discrepancy and it took me quite some >> time hunting down a cryptic backtrace when authoring the new mcron >> configuration records. > > I see. However, this is a wide-ranging change, so I think this should > have been discussed separately from the mcron changes. I find it > important to take time for review and discussion for such changes. > >>> One last thing: placing =E2=80=98%location=E2=80=99 first can let us im= plement: >>> >>> (define (configuration-location config) >>> (struct-ref config 0)) >> >> Would this have worked? >> >> scheme@(gnu services mcron)> (define config (mcron-configuration)) >> scheme@(gnu services mcron)> (struct-ref 0 config) > > You got the order wrong. :-) Ah! Thanks for pointing my silly mistake. Then the argument would become... if it's good for define-configuration, it should have been good for define-record-type* the same (why the discrepancy?). After your new documentation in place to guide users to DTRT with regards to matching records, if you think %location should be the first field, then we should make it so in both instances, perhaps? >> All in all, I think that's a rather small change that got our internal >> implementation of both type of records in sync between >> define-configuration and define-record-type*, that should pave the way >> for migrating more of the later to the former without risking breaking >> something, going forward. > > Fundamentally, the layout of record types should not be visible to > users. That it is visible via =E2=80=98match=E2=80=99 is the problem, an= d the solution > is not to tweak record type layout but instead tp make sure =E2=80=98matc= h=E2=80=99 uses > on records vanish. > > I hope that makes sense! Yes, and I agree. >> scheme@(gnu services mcron)> ,use (oop goops) > > Speaking of which: there was a conscious decision to not use GOOPS in > Guix from day one. Perhaps some day we=E2=80=99ll want to collectively q= uestion > that, but let=E2=80=99s make sure we don=E2=80=99t add that dependency on= a whim. > > For example: > > class-of -> struct-vtable > class-name -> record-type-name > > See commit 50c17ddd9e2983d71c125d89b422fd20fca476e1 for an example. Oops! Another point to add to our future coding style guidelines :-). Thanks for showing the simple workaround to goops. --=20 Thanks, Maxim