From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id 8C4xLXdjgmDGMAEAgWs5BA (envelope-from ) for ; Fri, 23 Apr 2021 08:04:39 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id aCDgKHdjgmCQIQAA1q6Kng (envelope-from ) for ; Fri, 23 Apr 2021 06:04:39 +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 65C65225DD for ; Fri, 23 Apr 2021 08:04:39 +0200 (CEST) Received: from localhost ([::1]:41132 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lZove-0007eX-Gd for larch@yhetil.org; Fri, 23 Apr 2021 02:04:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59650) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lZovV-0007eF-KR for guix-devel@gnu.org; Fri, 23 Apr 2021 02:04:29 -0400 Received: from h87-96-130-155.cust.a3fiber.se ([87.96.130.155]:42674 helo=mail.yoctocell.xyz) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lZovT-0002xt-SY for guix-devel@gnu.org; Fri, 23 Apr 2021 02:04:29 -0400 From: Xinglu Chen DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=yoctocell.xyz; s=mail; t=1619157862; bh=iEN5H38skqLAvY5HjxISCGQ9SulKyMI2IfbkT8D50HE=; h=From:To:Cc:Subject:In-Reply-To:References:Date; b=N3KtMM7lXfc7s0ELbvXM5FDcQW9ETRld+uIdo8FMwHNvHQ6Uj6y+g2sC6Utj4gqdr VUftLf2KBz3xfRxwyUAAClleYxSt5V2HTRW/rgOTBlqJB9KcuzzNuu0dse/CreHcgg yoZqr2JpSb8cLzxE/nHcAySLm4+ySncf/LFXZKP8= To: Maxim Cournoyer Subject: Re: Best practices for writing services In-Reply-To: <87tunx1uim.fsf@gmail.com> References: <878s6kqydj.fsf@yoctocell.xyz> <87wnswcmxi.fsf@gmail.com> <87k0ov7w72.fsf@yoctocell.xyz> <8735vjcy43.fsf@gmail.com> <87y2da6aon.fsf@yoctocell.xyz> <87tunx1uim.fsf@gmail.com> Date: Fri, 23 Apr 2021 08:04:22 +0200 Message-ID: <877dkt5yft.fsf@yoctocell.xyz> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=87.96.130.155; envelope-from=public@yoctocell.xyz; helo=mail.yoctocell.xyz X-Spam_score_int: 11 X-Spam_score: 1.1 X-Spam_bar: + X-Spam_report: (1.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, FROM_SUSPICIOUS_NTLD=0.224, PDS_OTHER_BAD_TLD=2, RDNS_DYNAMIC=0.982, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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 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=1619157879; 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=24iM2IA7bkMOuBTS9FOdcsQoIeD5k+U2AbCrBBAFCqs=; b=J5wGB7bw+jWv1IwV9ZRkpgZbJ13S8rzND7YcFKuUJbvgAV35vA5S7yLrVKcE7SidjCARtY 5kA8Y9QXq+t/yuZzKvLhztx++JozErdUvKuA4X1zNOv4Cktss2aMfOv7k8+0I8lh8e3KGq +zR75BvZd/qjRmFMqb6xK0K+fzk/yp7dFm3VvCFpcQA1wWfPSzUJxGZBas9J2GGmVBRYTL kOJkO8Ca5WUGtI+kUXgFPz2PEPWquawLYMpCNIdk4w+OHvpoGEJ2DWbbVPxMzGOq83DiRl cOYfjZXztACXVh0PeQfRLzA/XqnK+1zuN80kfHzkXC6IP5IYlNiuDGeNWWEByw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1619157879; a=rsa-sha256; cv=none; b=mhC/1vVt3SLL3jMT3WxpC9HVBM5c0R5hV9JJlcQ2dNH1fvcgVi+avSaaFvaU1iNK9WrTlB NX5Wcoe/E+nP1KZyTADndKOZzhMYXitcjQXAgwFuTkOA9k5/zki8/v6OSofKdptL4G2pYP 6YgMqQGi6tene5m5A7j/QdablmHYj+UFV4exON5mmmRfTTZyW5OsJGw6I8MdS5wMaH0A++ AAc3HUo+DuYx4aq5FzcS/5UUlpydphoz+Snwblxf2aGlQ7s9DmgDnQ2ePCLnqnk7rqNrvr YSadbw10mFhv2npoLlwfAYoubavmH7Ee5MKm6Ne5beBxlNxWvv31pCewjoms6w== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=yoctocell.xyz header.s=mail header.b=N3KtMM7l; dmarc=pass (policy=none) header.from=yoctocell.xyz; 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: -1.65 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=yoctocell.xyz header.s=mail header.b=N3KtMM7l; dmarc=pass (policy=none) header.from=yoctocell.xyz; 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: 65C65225DD X-Spam-Score: -1.65 X-Migadu-Scanner: scn0.migadu.com X-TUID: +erC+UYximbc Hi, On Fri, Apr 23 2021, Maxim Cournoyer wrote: >> But the problem here is that it doesn=E2=80=99t force the user to config= ure the >> field. In a Git config for example, the user should be forced to set >> =E2=80=98user.name=E2=80=99 and =E2=80=98user.email=E2=80=99, otherwise = they can=E2=80=99t commit anything. You >> will just have to set the default value to =E2=80=98disabled=E2=80=99, l= ike this: >> >> #+begin_src scheme >> (define (serialize-string field-name val) ...) >> (define-maybe string) >> (define-configuration test-config >> (config >> (maybe-string =E2=80=99disabled)) >> "docs"") >> #+end_src > > Ah, thanks for explaining, now I understand your point well. > > I've just tried something: > > --8<---------------cut here---------------start------------->8--- > (define-configuration test-config > (name (string #f) "Your name")) > scheme@(guile-user)> (test-config) > ice-9/boot-9.scm:1669:16: In procedure raise-exception: > ERROR: > 1. &message: "Invalid value for field name: #f" > 2. &configuration-error > --8<---------------cut here---------------end--------------->8--- > > So you could choose an invalid default value, which would force the user > to specify it (else they'd get the not so obvious error message above). > It should be improved too! I'll see if I can do something. That would be a workaround for now. Thank you!