From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id oGbhIaMmh2DBjgAAgWs5BA (envelope-from ) for ; Mon, 26 Apr 2021 22:46:27 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id MHKLHaMmh2BgNAAAB5/wlQ (envelope-from ) for ; Mon, 26 Apr 2021 20:46:27 +0000 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 F10171753A for ; Mon, 26 Apr 2021 22:46:25 +0200 (CEST) Received: from localhost ([::1]:36832 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lb87d-000287-2u for larch@yhetil.org; Mon, 26 Apr 2021 16:46:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39740) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lb87K-00023U-PV for guix-devel@gnu.org; Mon, 26 Apr 2021 16:46:06 -0400 Received: from mx1.riseup.net ([198.252.153.129]:53578) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lb87J-0000dI-3e for guix-devel@gnu.org; Mon, 26 Apr 2021 16:46:06 -0400 Received: from fews1.riseup.net (fews1-pn.riseup.net [10.0.1.83]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client CN "*.riseup.net", Issuer "Sectigo RSA Domain Validation Secure Server CA" (not verified)) by mx1.riseup.net (Postfix) with ESMTPS id 4FTcP816PNzDqF8; Mon, 26 Apr 2021 13:46:04 -0700 (PDT) X-Riseup-User-ID: 3BD8FEBFFDFFB4180AF52A386F1A97D2A6730F28437B2C8512E8768C94C0A378 Received: from [127.0.0.1] (localhost [127.0.0.1]) by fews1.riseup.net (Postfix) with ESMTPSA id 4FTcP70FZKz5w4h; Mon, 26 Apr 2021 13:46:02 -0700 (PDT) Date: Mon, 26 Apr 2021 22:29:01 +0200 From: raingloom To: Xinglu Chen Subject: Re: Best practices for writing services Message-ID: <20210426222901.52e46664@riseup.net> In-Reply-To: <871rb27plv.fsf@yoctocell.xyz> References: <878s6kqydj.fsf@yoctocell.xyz> <87wnswcmxi.fsf@gmail.com> <87k0ov7w72.fsf@yoctocell.xyz> <20210422001052.4b8c17ec@riseup.net> <871rb27plv.fsf@yoctocell.xyz> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=198.252.153.129; envelope-from=raingloom@riseup.net; helo=mx1.riseup.net X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-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.23 Precedence: list List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: guix-devel@gnu.org, Maxim Cournoyer Errors-To: guix-devel-bounces+larch=yhetil.org@gnu.org Sender: "Guix-devel" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1619469986; 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; bh=M4Wn5IFx2BK9dr8KiUvFr2XUX4Co27KdKR9aAhmOaTA=; b=QsOCEPJlmP08Nj6Prt019aSnKDT1kGCl0aH0/0OBzSudOAMJMLrdY+C+PZ4zp4tf8H3fKt HISEAESvsGKC2hfgwip5hAE4000LilfMftIjnRfEgpHdyX7vYveDyLPKh5tCo+WRKbH/rp lzp0l30jWvwQdqWC9OJACAk47loTbkIUir7DMo3ryikIkTswjnOUQ/kWhbjEOhAOOcAXe+ HvRGI109xskKqXsbr+AJtJhkbSlDmY1TpyPqkGeQJGXQoam/7dKlreBbxAznfjzaWim0k1 9XWvfLdrkhJGSTE/eyMbFozmrvca/3BFeEUk7Q8azuGChry8+TmGhe9oUs5znw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1619469986; a=rsa-sha256; cv=none; b=HHFfvK7uUZ/ONz9IEaEYajfdJsF72m8gglGVnEO8bICxOoss6ZTCkqaggzjkIi2z7A0YZ9 ed9KOd3Qd8OGdO8GotNYlOSjGbAqYHz9/ozqOIrz8boLEhmQcHwmbarAw1yDWYwFQm7k+G XUlcvlILzprg2tPA/3RiBugJpx/67mF1V5vTFJGPFc+URzroUcvSgBR69xnmQydjH1+cJT XBNUoQ7CnK3kmWDHsvhuUDqxZWfX0+465iB3UjrBKu0NJO9fPa2nEk+2U7PVJqx2VwoQEK TWqVLMzJxLN+2OP38AJNPl2POg17ts+kfIkR3MLJY3Fcrj/xki0Mx4C26RO1Fw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=riseup.net (policy=none); spf=pass (aspmx1.migadu.com: domain of guix-devel-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-devel-bounces@gnu.org X-Migadu-Spam-Score: -2.35 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=riseup.net (policy=none); spf=pass (aspmx1.migadu.com: domain of guix-devel-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-devel-bounces@gnu.org X-Migadu-Queue-Id: F10171753A X-Spam-Score: -2.35 X-Migadu-Scanner: scn0.migadu.com X-TUID: AKqhC8gRreuX On Thu, 22 Apr 2021 09:19:56 +0200 Xinglu Chen wrote: > On Thu, Apr 22 2021, raingloom wrote: >=20 > >> One thing that I find a little annoying is that you have to > >> specify a default value for the fields. =20 > > > > Are you sure? If you don't specify a default, won't the user just be > > forced to write > > (service whatever > > (whatever-configuration > > (mandatory-field 'bleepbloop))) > > > > instead of the shorter (service whatever)? =20 >=20 > If I write something like this >=20 > #+begin_src scheme > (use-modules (gnu services configuration)) > (define (serialize-list field-name val) "") > (define-configuration test-config > (config > (list) > "configuration for test")) > #+end_src >=20 > and evaluate it, I will get an error. I have to specify a default > value for the =E2=80=98config=E2=80=99 field to make it work. >=20 > #+begin_src scheme > (use-modules (gnu services configuration)) > (define (serialize-list field-name val) "") > (define-configuration test-config > (config > (list '()) ;default to '() > "configuration for test")) > #+end_src >=20 Weird. I'd consider this a bug in define-configuration. define-record-type* does not have this limitation.