From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id YN9eAvjxEWQLbQAASxT56A (envelope-from ) for ; Wed, 15 Mar 2023 17:27:36 +0100 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id MJpWAvjxEWQhQQEA9RJhRA (envelope-from ) for ; Wed, 15 Mar 2023 17:27:36 +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 CAAD422368 for ; Wed, 15 Mar 2023 17:27:35 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pcTxz-0003yX-42; Wed, 15 Mar 2023 12:27:07 -0400 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 1pcTxy-0003yP-6j for guix-devel@gnu.org; Wed, 15 Mar 2023 12:27:06 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pcTxw-0004m4-AZ; Wed, 15 Mar 2023 12:27:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To: From; bh=CEWFW2XF69G7Msu5ELRsuT1P1aWzTGh5KVmna2cvj5U=; b=pr337PrBygiVCUiAH1aO 9SthjVbIglKdqPKH4w6tfjr6NEPgRJqzbzShD/zY90YsEQQ20GGHpqXtyvTJxedVbGZqL4ikv+pzk E6ZJCLGn8hayhaAISNRkTNxzn7q/pHKo9JbvD2qX5QG61NbLhnu5xH2C+lbvgqqc0b/9I2ZtqkFD5 0rEGtR09VDZ82nJOOk3DfmPXXhWydISe7XEjPe3DKGu9FAS4gGLCdL7Xg8NHL2YYahQ5j0LUaVxss FcQE2CWixfN2Y5FO0ucds4QOrOEqrP2u/KGZaXS2IQ62fe+w3A4iQi2EFAsxAi4688FIwalMXLHA3 NPjKgveefaOyVw==; Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pcTxv-0005uO-UB; Wed, 15 Mar 2023 12:27:04 -0400 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Bruno Victal Cc: guix-devel , Felix Lechner , Liliana Marie Prikler , Maxim Cournoyer Subject: Re: Brainstorming ideas for define-configuration References: X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: Quintidi 25 =?utf-8?Q?Vent=C3=B4se?= an 231 de la =?utf-8?Q?R=C3=A9volution=2C?= jour du Thon X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu Date: Wed, 15 Mar 2023 17:27:02 +0100 In-Reply-To: (Bruno Victal's message of "Thu, 9 Mar 2023 02:28:01 +0000") Message-ID: <87v8j20yll.fsf@gnu.org> 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 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-Country: US X-Migadu-Flow: FLOW_IN ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gnu.org header.s=fencepost-gnu-org header.b=pr337PrB; 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"; dmarc=pass (policy=none) header.from=gnu.org ARC-Seal: i=1; s=key1; d=yhetil.org; t=1678897655; a=rsa-sha256; cv=none; b=CSKJ3HjkSlindivQw9iolrfOxxuMudcOaguyYeyRpN+ngHW79C1pepT099YDSO5RyPLEaO 8bKAsHsTqn722QGBo8pdxcng46ZiBK6/UsvCbxCJN2dklDLVmB6AN3Scbo0uAbpPVhtu/X BjKXUMZSH8PQEs74iBD7agZ2/KGyupSgIJEGaqgTsQ1TAfcgFALpO/KVwPNqri9aHIQyy9 h77HpRdrU+dXfjrhz9iHHpsCjlHSwnpuFpqVUDt/YZGHeH0gBF3oz6uqT7O3YJnRHTRlI+ cz4z3bbedVZDbOM2qsUDXpQN1ziRGUXiqNZvtTvWB29rNyd5T8447WvNylk1iQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1678897655; 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=CEWFW2XF69G7Msu5ELRsuT1P1aWzTGh5KVmna2cvj5U=; b=bfw7qplFCH0facXA/F5iIFkVzwXYHA3DJSsVj3jzJdrIG34LCpNcXtu65lKh6JY/5HRCCd vljRKV7rUy4fnhBOfqKLsAWGrM1wPla/Ykb+biVvGpaK9KB/8x6YYkU2UlBR6qEKVRUVTG /z/dTuCwRZJYy2ExiSFRHVtAFHQopMzvt3a2orw8gGz6sJSc4FR6DwtDrT7Wh+1cw8XurL HUNlvn6m5NoECnqLDhKaKEyL7T14QBOLlRKAZxIn/viFKsneBZrPkGibBAGr55ajpLLHbV 3v5g58Q7diPMwl2YBDQJP1F1Oc16RYwfoMuiZQJU8yzeXNn8KKvxHYiaZFoAgQ== X-Migadu-Spam-Score: -6.26 X-Spam-Score: -6.26 X-Migadu-Queue-Id: CAAD422368 X-Migadu-Scanner: scn1.migadu.com Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gnu.org header.s=fencepost-gnu-org header.b=pr337PrB; 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"; dmarc=pass (policy=none) header.from=gnu.org X-TUID: SU/TmygdYEP9 Hi, Bruno Victal skribis: > User-specified sanitizer support Yay! > ;; Suggestion #2 > ;; A user-supplied procedure ('procname' below) would work just like the > ;; procedure in option #1. > ;; There is some similiarity to the Guix record-type*. > ;; This could be extended more easily in the future should it be required. > (define-type typename ; maybe call this 'define-configuration-type= ' ? > (sanitizer procname) > (maybe-type? #t) > ;; The properties below are service specific. > ;; If this is implemented with Guix record-type* then we could have a > ;; module containing generic types and do something along the lines of: > ;; (define-type foo-ip-address > ;; (inherit generic-ip-address) > ;; (serializer ...)) > (serializer procname) ; define-type/no-serialization =3D sets this= field to #f ? > (prefix ...)) I think we should implement contracts at this point, and have per-field contracts. We need to look at what Racket is doing. > Record Validator > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D > > There is also a need to validate records. Matching fields alone do not ac= tually > ensure that the configuration is coherent and usable. For example, some f= ields > may be mutually incompatible with others. Does that require special support though? Currently that can be done at serialization time, for example. > Coalesced documentation > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D > > Currently, we manually edit the texinfo output from configuration->docume= ntation > if we're unsatisfied with the generated result. > For instance, substituting @item with an @itemx marker for fields whose > documentation is similar. Good idea. > Serializer access to other fields > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D > > Serialization procedures generally only have access to the values of its = own field. That > may be insufficient in some cases as whether a field can be serialized > or how that is done, for example, can depend on the value of other fields. Overall, I find it nice that serializers have access to nothing but their own field value; that makes it easier to reason about the whole process. > mympd-service-type is one example where each serialized field depends on = the value of > another field. Our standard serializer procedures were useless for that c= ase. It=E2=80=99d be interesting to look more closely at this example and see if= this can be solved in some other way or if we really need =E2=80=98define-configuration=E2=80=99 support. Would be nice to see if si= milar situations arise with other records. > Inheritable record-type definition I=E2=80=99d like to support type inheritance in =E2=80=98define-record-type= *=E2=80=99, and =E2=80=98define-configuration=E2=80=99 could build on top of that. > Generic serialize-configuration > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D > > The procedure serialize-configuration inherently assumes that the seriali= zed > configuration must be a single string. This assumption needn't always hol= d, especially > if the service in question is not a shepherd service. Hmm, no opinion on that one. Thanks for the grocery list! :-) Ludo=E2=80=99.