From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id 2LBBEn7jQ2EFaAEAgWs5BA (envelope-from ) for ; Fri, 17 Sep 2021 02:38:22 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id 2DnbDX7jQ2H9GgAAbx9fmQ (envelope-from ) for ; Fri, 17 Sep 2021 00:38:22 +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 49AE993D6 for ; Fri, 17 Sep 2021 02:38:21 +0200 (CEST) Received: from localhost ([::1]:49000 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mR1tU-0007Jx-GP for larch@yhetil.org; Thu, 16 Sep 2021 20:38:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34058) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mR1tD-0007IZ-6P for guix-patches@gnu.org; Thu, 16 Sep 2021 20:38:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:46397) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mR1tC-0001P3-LL for guix-patches@gnu.org; Thu, 16 Sep 2021 20:38:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mR1tC-00069y-8f for guix-patches@gnu.org; Thu, 16 Sep 2021 20:38:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#50614] [PATCH core-updates] build: utils: Add =?UTF-8?Q?=E2=80=98optional=E2=80=99?= macro. Resent-From: Sarah Morgensen Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 17 Sep 2021 00:38:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 50614 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Xinglu Chen Cc: 50614@debbugs.gnu.org Received: via spool by 50614-submit@debbugs.gnu.org id=B50614.163183905023621 (code B ref 50614); Fri, 17 Sep 2021 00:38:02 +0000 Received: (at 50614) by debbugs.gnu.org; 17 Sep 2021 00:37:30 +0000 Received: from localhost ([127.0.0.1]:57943 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mR1sg-00068t-Hr for submit@debbugs.gnu.org; Thu, 16 Sep 2021 20:37:30 -0400 Received: from out2.migadu.com ([188.165.223.204]:47882) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mR1sd-00068g-L5 for 50614@debbugs.gnu.org; Thu, 16 Sep 2021 20:37:29 -0400 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mgsn.dev; s=key1; t=1631839046; h=from:from: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; bh=a4189ToxF8Lyjx7eWNVvTuEaAidd1nlJ7QpfDWAqB+U=; b=T5GGDlhIK7jJw17sl12VDUeuJau9LdYDpPnzxmf+F1IBltzUE64QApe/r+MqKMl9MFQ/LT CMFdWeKV7HtN722peEh3Ff1P6V/aOBtKDsh7plNQYSXklmASky2icjGy+MRPrZ6HVwMjoP pfZn4Z99auB6/13ueN87XSC/JXPlL38= From: Sarah Morgensen References: Date: Thu, 16 Sep 2021 17:37:24 -0700 In-Reply-To: (Xinglu Chen's message of "Thu, 16 Sep 2021 09:11:22 +0200 (17 hours, 10 minutes, 11 seconds ago)") Message-ID: <864kakhwaj.fsf@mgsn.dev> 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" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1631839101; 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:dkim-signature; bh=a4189ToxF8Lyjx7eWNVvTuEaAidd1nlJ7QpfDWAqB+U=; b=Qd4/jtNRUAvfGJNRZ7rXo2P2d1JvmiJBd64qddmj2gOtYcSXQTZgkYWK7eFgsq2wZILudV w2hA+w9QHjw8a8BAGoL3WWaZFpeD/h9cki/lCngR/POj9+6d9oMBxMd1tWSvUpO9CpRFu0 qzHV/RscRMV88VLsJEHvrQ2bHudvo61hAtgDq+1ePVOV9wbfHJr53pIgAW24S96U2qRNdw sT3EbKmUzgqVqmbSsXRgqPf1+rO74aPiCJwY6hlCWNneHL83xgDVPNf1I7J/guAv/Hk/XZ j7TISvyeE+JbS9uiIq6rox5vGzYmFhsrCU4OhvhRA3dFeGt/euCLfkdNoQ2X1Q== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1631839101; a=rsa-sha256; cv=none; b=o7WrQ2+mD47T4xKxW7TIraIZRTChhnWCFL0RZTTd038UBZMfKDHkBhzQ802u8zmk3meZMy Nnpr/Y9FEvu+Tnb28urL/lVr/SbdSSXkBtEjrjdcd/xA8iTCMkk8dgfdymBPmDa1yfQm3u P68SeRYFncH2dpSpuFqpMmYFyxhUoiCpcU17sUwZD0gnY9MMCE3iSZRhBnregh4UUgqS/V DDjNHUu+HcVCgX4HbnCxIDhllbDxjJDOTJu2TxeXHXOunq/YgvfTwltIhVeUZbqotJg+ID kdy0KvxbAB0xt5quHPp7YMVEoMjQ5Y/8Uicm+NEBR/svZmj76yS8BqRrXB/lKA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=mgsn.dev header.s=key1 header.b=T5GGDlhI; spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Spam-Score: -1.30 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=mgsn.dev header.s=key1 header.b=T5GGDlhI; dmarc=fail reason="SPF not aligned (relaxed)" header.from=mgsn.dev (policy=none); spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Queue-Id: 49AE993D6 X-Spam-Score: -1.30 X-Migadu-Scanner: scn0.migadu.com X-TUID: jo1DR4B99SSE Hi, Xinglu Chen writes: > * guix/build/utils.scm (optional): New syntax > * tests/build-utils.scm ("optional: expr1 is non-#f", optional: expr1 is = #f"): > Test it. > * guix.texi (Build Utilities): Document it. > --- > A common idiom I have seen is > > (if EXPR1 > EXPR2 > '()) > > with the =E2=80=98optional=E2=80=99 macro, one can just write > > (optional EXPR1 > EXPR2) > > I am not sure if =E2=80=98optional=E2=80=99 is the best name (it was insp= ired by > =E2=80=98lib.optional=E2=80=99 in Nixpkgs), feedback welcome! I like the idea! But perhaps if we're getting rid of boilerplate, we should go all the way and make it so that instead of (if EXPR1 `(EXPR2 EXPR3) '()) we can write (optional EXPR1 EXPR2 EXPR3) What do you think? Also, maybe 'list-when' for the name? > +@deffn {Scheme Syntax} optional @var{test} @var{consequent} > +Like @code{when} (@pxref{Conditionals,,, guile, GNU Guile Reference > +Manual}), but if @var{test} evaluates to false, return the empty list. > +This is replaces the following idiom: ^ no "is" > +@end deffn > + > +@lisp > +(if @var{test} > + @var{consequent} > + '()) > +@end lisp > + > +with this: > + > +@lisp > +(optional @var{test} > + @var{consequent}) > +@end lisp=20=20=20=20=20=20=20=20=20=20 > + > +It can be useful when certain targets require an additional configure ^ no "an" > +flags, e.g., > + > +@lisp > +(arguments > + `(#:configure-flags (list "--localstatedir=3D/var" > + "--sysconfdir=3D/etc" > + ,@@(optional (hurd-target?) '("--with-courage= ")))) ^ extra "@"? -- Sarah