From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id 2FlXMJzJQWLpLQEAgWs5BA (envelope-from ) for ; Mon, 28 Mar 2022 16:43:40 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id +JZXLZzJQWIt6wAAauVa8A (envelope-from ) for ; Mon, 28 Mar 2022 16:43:40 +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 A556510972 for ; Mon, 28 Mar 2022 16:43:39 +0200 (CEST) Received: from localhost ([::1]:55752 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nYqao-0000hb-Lv for larch@yhetil.org; Mon, 28 Mar 2022 10:43:38 -0400 Received: from eggs.gnu.org ([209.51.188.92]:47898) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nYqSq-0006TF-2P for guix-devel@gnu.org; Mon, 28 Mar 2022 10:35:27 -0400 Received: from mail-4022.proton.ch ([185.70.40.22]:44565) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nYqSm-0001YH-Cl for guix-devel@gnu.org; Mon, 28 Mar 2022 10:35:23 -0400 Date: Mon, 28 Mar 2022 14:35:12 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lendvai.name; s=protonmail3; t=1648478116; bh=qh2Pd2YrJ1YuwuJ6fBjHqyVUCjXQZsPAvoIcN9qE8yQ=; h=Date:To:From:Cc:Reply-To:Subject:Message-ID:From:To:Cc:Date: Subject:Reply-To:Feedback-ID:Message-ID; b=gWhcJho+xtvyQVcG9/KGXklreI4eTiTXJfewq4Ccl9ArAhh2Hc2TjEvZSmfsPRCEG XRHXR2pN92/Gmf0TEWpt1+4+5gs1nE5DNY5udyx9/2fF/GPnC9oNMebq+XmFty9y22 DlO/iyHrGHKvQSd6OCTq5prMQ4vq49cejLAubcX5ORviR2E8FoLe3Zvj3Eg7+E4Q4a 0lw/PcqlDHompljhjXoESmjj79STp1RFBsfUSEAfRdHIYBf6W4+GM3LIG6F3YPflHu LP9gL0T+CfIv1xuUs4hyZ/iOjwvHOVd6ixTJDLKOURBDGJ256H3ocs3o+sHIHFBAS7 5cx4745wTu+7w== To: =?utf-8?Q?Ludovic_Court=C3=A8s?= From: Attila Lendvai Subject: using srfi-189 in (gnu services configuration) Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=185.70.40.22; envelope-from=attila@lendvai.name; helo=mail-4022.proton.ch 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, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: , Reply-To: Attila Lendvai Cc: guix-devel Errors-To: guix-devel-bounces+larch=yhetil.org@gnu.org Sender: "Guix-devel" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1648478619; h=from:from:sender:sender:reply-to: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:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=qh2Pd2YrJ1YuwuJ6fBjHqyVUCjXQZsPAvoIcN9qE8yQ=; b=akFa7bRq4P5jUtOM5cUy7zBCfcL/iPPA70UhWBTMU8FOaYyd+QOfH2wzSJwxxc2bbi3Ci2 6LU+rB5jxSci6bgYNkKEQhEB8xMtzMBm5V1H74fYHxp5ZCBIJvD61QFf/02I3O0qEpTQ4Z 5vMIdDEaVhj6nyueMPaagYF2jd812eMUjZxCMqhcAh7ewi8dLEUlHQPRfl0UpzeE5B1QtL HJ3NDJDTuTSXbliVhvahs4rX9j2i91Q5jAcaAOdoMyZVhTdRBDy9pHxPqplWtijTHc6xl6 7WEm6VYpc9h8i8j2ZFr87FYP1qtsfssiVQtfF8+vRRFVHd3o6KkeYS9bMFKP4g== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1648478619; a=rsa-sha256; cv=none; b=dFz0EYzpiaYOo2RgbgG2n7rPM0KhHc+XQb84GyY27NpRiN9zf2OzMmrT6nlnFfU9mEFOdW r4wQUys3oGm+iR4Qu3l7QNW5P/Wg3o9oCxD8/6z6jWixaEUqumIp3xlUAGlDs8jAlMb2TW 4goev5hXAt7jEWvnTOp+ygrfymNyrqDxZiPT54B4RARvNa9kEKNbkkj1YvRigJu9cVFgxN 3z6l97T0L+CIQ9x2dBO6YhNZ6cJEtaSyeb+KHQCJHH/rebxaVk+rjgKCS1G6SBqGpNa9aS CxRyIJQl+6G2VYJegjo0TQubmptt5YxZ7JLx9vRTQex1jLXwcuv9USNhmTJ62Q== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=lendvai.name header.s=protonmail3 header.b=gWhcJho+; dmarc=none; 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: -3.57 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=lendvai.name header.s=protonmail3 header.b=gWhcJho+; dmarc=none; 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: A556510972 X-Spam-Score: -3.57 X-Migadu-Scanner: scn0.migadu.com X-TUID: iGELnXFIgzcW this is a follow up to: using an SRFI that is not available in Guile https://lists.gnu.org/archive/html/guix-devel/2022-01/msg00249.html let me summarize the discussion, and with that my argument why i'd like to use srfi-189 in the configuration code: - sometimes we need to be able to unambiguously distinguish whether a config field value has been specified by the user or not. the reason is that in some situations setting a config value by the user is actually an error; e.g. when field A's value is derived from field B's value, but only sometimes, depending on the actual value of B. in the current setup, simply specifying a default value would make it impossible to distinguish, because by the time the code of the service is executed, the default value is already written into the field. - the current code uses the symbol 'DISABLED as a special field value to signify that the field has not been set (i.e. what Nothing would mean if we used srfi-189). it is rather confusing, because many config fields are boolean fields, where 'DISABLED sounds like a valid off value. it is also prone for clashes with user specified values. - the current codebase also uses 'UNDEFINED as yet another special marker. once i understood, but unfortunately, i have forgotten what for since then... looks like only as a marker in the macro for the situation when no default value form has been specified for a field's definition. - using symbols as markers for special values is a bad idea, because the user may specify a field type to be SYMBOL?, which wouldn't error when the value is 'DISABLED. - we can't use Guile's *UNSPECIFIED* for this, because the underlying record implementation of Guile uses it for pretty much the same thing, and it errors whenever this value is encountered in a record's field. - i see only one way to implement this in the current setup that may be doable: use DEFINE-RECORD* (already a loss of many features of CONFIGURATION), use thunked fields, and squeeze the logic into the default thunk of every field separately. at least in my case, it would force a rather unnatural shape on the code. understanding the code would be only possible if the reader has a proper understanding of thunked fields and what is executed when -- which is arguably a harder requirement than grasping Maybe and Nothing. - srfi-189's Maybe and Nothing may come useful in other parts of the Guix codebase. the Maybe and Nothing types/abstranctions implement a solution exactly for this problem: the ability to detect and deal with the/a special Nothing value. the first stage of this adventure, namely adding guile-srfi-189 to the packages, has been merged. now, the second stage is going to be a non-trivial task for me, therefore before i venture into incorporating the use srfi-189 into the configuration codebase, and before we can see what the actual implementation looks like, i'd like to ask the maintainers to speak up if either: 1) they have been convinced that this may actually turn out well, or 2) if they still have strong feelings against this venture, and would probably oppose the use of sfri-189, regardless of the qualities of the resulting patch. any feedback is appreciated, -- =E2=80=A2 attila lendvai =E2=80=A2 PGP: 963F 5D5F 45C7 DFCD 0A39 -- =E2=80=9CLearning without thinking is useless. Thinking without learning is= dangerous.=E2=80=9D =09=E2=80=94 Confucius (551=E2=80=93479 BC), 'The Analects'