From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:403:478a::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id kB8JOCtRIWUHGAAAauVa8A:P1 (envelope-from ) for ; Sat, 07 Oct 2023 14:38:04 +0200 Received: from aspmx1.migadu.com ([2001:41d0:403:478a::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id kB8JOCtRIWUHGAAAauVa8A (envelope-from ) for ; Sat, 07 Oct 2023 14:38:04 +0200 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 71A9461B74 for ; Sat, 7 Oct 2023 14:38:03 +0200 (CEST) Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1696682283; 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:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post; bh=j9rmRD23WoLxkav/Lm3zzkInniy4oGnDPn7Zp/cpBso=; b=UMJifCsmFPnN56QTlBTbQ2O801uygTsHWWl1p1yNHUbvZ/+DJwrNbLyP2jJTlmUygYr3n0 WN/JM3pamyjh4ywKLVWfZlfzAqYbLddM8maxB8Who0fw9wTx1nIZ/iM+5fTTbZ2kXfzy+A dPmJEZw4EJPvB22ycFKo0ECGAoABgqSDEo0NRwgNp1x9OnJ0x3psdZFnt7udrSc7wMPOLm dMcTHh5PeRB3Dd83SQdjH3jrvbsKuHpAWKmZ5k4T7NKWgT/9++d/bA9olvYLowVMvnijUd L6gwf5b7kz5MkgIT9WF4aRWVL2oaEOQhLrE6k5oOtT37kbS8BYX484utdn2Rzw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1696682283; a=rsa-sha256; cv=none; b=S4uOlncwdEA4YXK+mE0+ZvZKgUY7KQkbxntUD3BEahkqSk+j+OMpHkPgNfgqgWamD8nw65 0rLhDu58tuWU+YBZwTm8GrXbbMRlxnRj+yxbRdA/RGPMf60UOy/3oRlVt3yE8SMCDdVwhr Ha0LmouUyaU4h6rM9vw1Y9qqbaD/lU0MTqYYbQxwcDXPRyb89VFlyjxt16rcwqDIE2KHfm vZHQDvuoyZ0E52PeKmJYzAuGQ0WrI3z7oK+AHQBIfqqCr1X3e8zw0L1f94e/gS5Oprb+gc pSIm5D2qXZlRxrItwHyom7/HTNnw47M8uNFA9edbtOuYeje+Fll+h2JqKNsMTw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qp6Yz-000292-4J; Sat, 07 Oct 2023 08:37:45 -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 1qp6Yx-00028o-54 for guix-patches@gnu.org; Sat, 07 Oct 2023 08:37:43 -0400 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 1qp6Yw-0002cw-T0 for guix-patches@gnu.org; Sat, 07 Oct 2023 08:37:42 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qp6ZF-0006uG-W7 for guix-patches@gnu.org; Sat, 07 Oct 2023 08:38:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#63985] [PATCH v3 01/11] services: configuration: Simplify normalize-extra-args. (was: bug#63985: [PATCH RFC 0/5] Generic INI serializer & SRFI-171 for define-configuration) Resent-From: Bruno Victal Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 07 Oct 2023 12:38:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 63985 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Maxim Cournoyer Cc: 63985@debbugs.gnu.org Received: via spool by 63985-submit@debbugs.gnu.org id=B63985.169668223126486 (code B ref 63985); Sat, 07 Oct 2023 12:38:01 +0000 Received: (at 63985) by debbugs.gnu.org; 7 Oct 2023 12:37:11 +0000 Received: from localhost ([127.0.0.1]:53537 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qp6YR-0006t8-D6 for submit@debbugs.gnu.org; Sat, 07 Oct 2023 08:37:11 -0400 Received: from smtpmciv1.myservices.hosting ([185.26.107.237]:41500) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qp6YP-0006t0-Re for 63985@debbugs.gnu.org; Sat, 07 Oct 2023 08:37:10 -0400 Received: from mail1.netim.hosting (unknown [185.26.106.173]) by smtpmciv1.myservices.hosting (Postfix) with ESMTP id EF31920E38; Sat, 7 Oct 2023 14:36:43 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by mail1.netim.hosting (Postfix) with ESMTP id 64DEC80098; Sat, 7 Oct 2023 14:36:37 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at mail1.netim.hosting Received: from mail1.netim.hosting ([127.0.0.1]) by localhost (mail1-2.netim.hosting [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id SlQBGcArZXVr; Sat, 7 Oct 2023 14:36:37 +0200 (CEST) Received: from guix-nuc (unknown [10.192.1.83]) (Authenticated sender: lumen@makinata.eu) by mail1.netim.hosting (Postfix) with ESMTPSA id 6FB5980092; Sat, 7 Oct 2023 14:36:36 +0200 (CEST) From: Bruno Victal In-Reply-To: <87bkdh3qou.fsf_-_@gmail.com> (Maxim Cournoyer's message of "Mon, 02 Oct 2023 13:00:17 -0400") References: <22471a74b258f7169961898eed9e18cee7504f60.1687816734.git.mirai@makinata.eu> <87bkdh3qou.fsf_-_@gmail.com> X-Hashcash: 1:26:231007:maxim.cournoyer@gmail.com::he+JtQC+aj5HxhxQ:TC1D X-Hashcash: 1:26:231007:63985@debbugs.gnu.org::ijDCfQ3QicyuLCSD:5xIyd Date: Sat, 07 Oct 2023 13:36:35 +0100 Message-ID: <87h6n238z0.fsf_-_@makinata.eu> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Scanner: mx0.migadu.com X-Migadu-Spam-Score: -6.22 X-Spam-Score: -6.22 X-Migadu-Queue-Id: 71A9461B74 X-TUID: bj9h0p7h0Cd7 Hi Maxim, Maxim Cournoyer writes: > Bruno Victal writes: >> (begin >> (warning #f (G_ "specifying serializers after documentation = is \ >> deprecated, use (serializer ~a) instead~%") (syntax->datum #'proc)) >> - (values (list %unset-value #'proc))))))) >> + (values (list #f #'proc))))))) >>=20=20 >> (syntax-case syn () >> ((_ stem (field field-type+def doc extra-args ...) ...) >> @@ -239,11 +239,11 @@ (define (define-configuration-helper serialize? se= rializer-prefix syn) >> default-value)) >> #'((field-type def) ...))) >> ((field-sanitizer ...) >> - (map maybe-value #'(sanitizer* ...))) >> + #'(sanitizer* ...)) >> ((field-serializer ...) >> (map (lambda (type proc) >> (and serialize? >> - (or (maybe-value proc) >> + (or proc > > I haven't applied it locally so may be out of context, but how do we > ensure here that sanitizer and proc aren't set to #f before calling > them? In the (or proc =E2=80=A6) clause the logic is still equivalent to the prev= ious (maybe-value proc) wrapped one. There's no problem with proc being #f as it either means that the field is marked as `no-serialization' or it will use the =E2=80=9Cdefault=E2=80=9D serializers that appears latter with= in the (or =E2=80=A6) clause. For sanitizers it boils down to this check further down: --8<---------------cut here---------------start------------->8--- ;; Define field validation macros. #,@(filter-map (lambda (name pred sanitizer) (if sanitizer #f (default-field-sanitizer name pred))) #'(field ...) #'(field-predicate ...) #'(field-sanitizer ...)) --8<---------------cut here---------------end--------------->8--- So if a custom sanitizer wasn't provided (which is marked internally as #f) then this filter-map will take care of defining a default one for it. --=20 Thanks, Bruno.